-
Notifications
You must be signed in to change notification settings - Fork 0
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
DC-570: Update swagger to reflect new schema validation #157
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing a JSON schema, JSON example, and stringified JSON example all defined separately makes me concerned that a future change to the schema would not fully propagate to all of those places, leading to inconsistent documentation.
Had you considered consolidating to a single JSON schema with embedded examples, and/or referencing your example in common.openapi.yaml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a little more work can be done to clean this up, see my comments.
Also, did you try creating a catalog entry using this example? You should make sure it works OK before merging it up.
examples: | ||
jsonObject: | ||
summary: A sample object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked into this more and I think we should be able to get externalValue
to work. The problem is that the index.html
that ships with swagger doesn't support it yet. See swagger-api/swagger-ui#5433
For now, you should look at the example HTML solutions on that GitHub issue and add one to our copy of index.html
(which is in service/src/main/resources/templates
).
@@ -0,0 +1,192 @@ | |||
{ | |||
"dct:title": "sint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it wasn't obvious how to generate this example, can you document the steps to do it somewhere, such as in a file in the docs
directory.
@@ -103,7 +103,7 @@ | |||
}, | |||
"contributors": { | |||
"type": "array", | |||
"items": { "$ref": "#/defs/contributor" } | |||
"items": { "$ref": "#/$defs/contributor" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deliberate change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mild approval - I do not know swagger that well, but nothing's jumping out as bad
Kudos, SonarCloud Quality Gate passed! |
@@ -103,7 +103,7 @@ | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix this one too? The line above this should be
"$ref": "#/$defs/samples"
Not sure why we're not seeing errors in our app due to typos like this. Maybe we need to be loading the schema in a stricter mode, if one exists.
I've moved these changes to #162 |
No description provided.