Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom deserialization and primitive strings #481

Closed
gaffney opened this issue Mar 11, 2014 · 4 comments
Closed

Support custom deserialization and primitive strings #481

gaffney opened this issue Mar 11, 2014 · 4 comments

Comments

@gaffney
Copy link

gaffney commented Mar 11, 2014

I have a DateRanges object that, while having a "start" and "end" member, is deserialized as a primitive array, e.g. ['20130210-20130315','20130520-20130524'] rather than

[
  {
    "start":"2013-02-10",
    "end":"2013-03-15"
   },
  {
    "start":"2013-05-20",
    "end":"2013-05-24"
  }
]

since I use @JsonValue in the Set<DateRange> getter. (And DateRange has it's start and end elements ignored with @JsonIgnore.)

That said, my Json object already does this properly (and I have custom deserializer for each in the ObjectMapper), but I don't believe I have a way of telling Swagger to use my parser. The model it shows in the UI is totally off.

@gaffney
Copy link
Author

gaffney commented Mar 11, 2014

And yes I realize I can use a model converter; my point here is that I shouldn't have to.

@fehguy
Copy link
Contributor

fehguy commented Mar 19, 2014

Hi, I'm happy to merge any commonly-used formatters into the core. There are a lot of combinations so we haven't covered them all. If you'd like to join in and contribute, it'd be appreciated.

@rage-shadowman
Copy link

A validating regex format parameter would be a good addition for string query parameters. Then you could describe the query parameter: DateRange in string format [show format here]

@fehguy
Copy link
Contributor

fehguy commented Jun 16, 2014

Hi, you should be able to use the fix in #588 to address the same goal.

@fehguy fehguy closed this as completed Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants