-
Notifications
You must be signed in to change notification settings - Fork 83
Schema.getAdditionalProperties(): return something better as Object? #257
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
Comments
Discussed in Sept 10 hangout. +1 to the way Kaizen's has done it.
|
|
Thank you for discussing this in the Hangout, and thank you for reporting here the decision. Current (1.0):
Is the idea to have:
Then I understand that I prefer this solution, because if users are using But you have mentioned:
Then the only modification is that |
Additional proposition: We have also already 2 setters: I think they should be renamed to: Boolean setAdditionalPropertiesBoolean(Boolean)
Schema setAdditionalPropertiesSchema(Schema) In order to be consistent with the getters. |
Good catch @jmini We discussed in today's hangout and agreed with the additions of:
And deprecate the existing ones in |
PR for this: #277. Feedback welcomed. |
Implementation for microprofile/microprofile-open-api#257 Microprofile on commit: jmini/microprofile-open-api@8898545
PR for |
Both PRs has been merged (for |
Both PRs has been merged (for |
Per spec:
additionalProperties
in a Schema object can be an Object or a Boolean.See OAI/OpenAPI-Specification#668 (comment)
In the code,
Object
is returned:https://github.com/eclipse/microprofile-open-api/blob/c2a26360d460bfe07b30c83ba4fe6f9cc73543c6/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java#L641
This is not really user-friendly because the user needs to know that this
Object
can be aSchema
or aBoolean
and write code withinstanceOf
to reflect this.Kaizen Model has 2 getters for this:
Boolean getAdditionalProperties()
Schema getAdditionalPropertiesSchema()
I do not like this either, but it is better in a sense that no
instanceOf
is needed.kaizen-parser Schema.java
What is the typical java way of telling
Schama
orBoolean
(a sort of Union Types)?A new Interface
AdditionalProperties
with 2 getters returning an optional:Optional<Schema> getAsSchema()
Optional<Boolean> getAsBoolean()
The text was updated successfully, but these errors were encountered: