-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Swagger 2.0 ModelConverter support for required/not required items #2420
Comments
@pjfanning I am not sure I understand what you mean; can you provide some more details about your case? |
The setRequired(boolean) method is no longer supported in swagger-core v2.0.0. As far as I can work out, the code will need to call setRequired(Collection) on the parent property. I'm not sure how this can be achieved in the ModelConverter and it does not seem to provide access to parent properties. |
There is an ongoing effort to rationalize converter/resolver code tracked in #2593, with just merged PR #2594 implementing a first phase which can help with scala converter issue, as it adds parent resolved schema as parameter of ModelConverter Let me know if this can help, also added a note in #2593 to keep track of any further changes affecting / involving updates of scala converter project. |
Closed due to #2593 |
@frantuma I had a look after the swagger-core 2.0.0 release but still can't work out a way to rewrite the swagger-scala-module ModelConverter to properly support optional properties. Would you be able to review my comment from Dec 18? |
@pjfanning the name of the field is resolved (if not passed in |
@frantuma thanks for your suggestions My partial rewrite for swagger 2.0.0 is https://github.com/pjfanning/swagger-scala-module/blob/swagger-core-2.0.0/src/main/scala/io/swagger/scala/converter/SwaggerScalaModelConverter.scala I tried you idea about SwaggerScalaModelConverter extending ModelResolver and overriding decorateModelName but this turns out not to be what I need. decorateModelName gives the model name but I need the fieldName for In my example above ( Is there any chance that |
ref #2420 - adds propertyName to annotatedType
@pjfanning not sure if this helps in all cases, however #2909 adds propName to annotatedType, try to give it a go. |
Closing because @frantuma 's has helped me to progress my scala solution |
With the Required field having moved to the parent property (example), I'm wondering how to get swagger-scala-module ModelConverter to be able to control which items in a case class are marked as required. The
resolve
method doesn't appear to expose the parent property. Is there another way to do this, or do we need to change the ModelConverter resolve to allow access to the parent property?The text was updated successfully, but these errors were encountered: