Skip to content

Cannot override model as a primitive type #573

Closed
@e28eta

Description

@e28eta

I can't figure out how to override a class and specify that it should be a primitive type

For example, given:

class Foo {
  Date myDate
}

How do I make swagger think that Dates should be strings, such that swagger-ui (and other clients following the spec) thinks that this is a valid Foo object:

{ "myDate": "2014-01-01" }

I've tried this: https://github.com/wordnik/swagger-core/wiki/overriding-models
However, that results in clients expecting that Foo objects look like this:

{ "myDate": { "value": "2014-01-01" } }

I also want to attach a description (for example) to the date class that specify recognized formats.

So far I want this for things like dates (XMLGregorianCalendar), BigDecimal, and BigInteger, where our JSON serialization knows how to serialize/deserialize as strings in a particular format.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions