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

Remove type: object restriction in empty() #648

Merged
merged 1 commit into from
Jun 12, 2023
Merged

Conversation

jayvdb
Copy link
Contributor

@jayvdb jayvdb commented Jun 12, 2023

Fixes #647

@@ -4477,7 +4474,6 @@ fn derive_schema_with_unit_hashmap() {
"volumes": {
"additionalProperties": {
"additionalProperties": {
"type": "object",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this one. To begin with I dont get HashMap<(), ()> because in JSON keys must be strings. https://stackoverflow.com/questions/9304528/why-json-allows-only-string-to-be-a-key

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was to provide some sort of compatibility for #576 to mitigate a case where additionalProperties key and value is both defined as empty object {} as seen in docker's OpenAPI specification.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for compatibility it does not matter whether there actually is type: object or not because it is enough that utoipa parses and compiles the schema.

Copy link
Owner

@juhaku juhaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@juhaku juhaku merged commit 1774bb7 into juhaku:master Jun 12, 2023
@jayvdb jayvdb deleted the fix-empty branch June 13, 2023 01:58
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

Successfully merging this pull request may close these issues.

openapi::schema::empty is confusing or wrong
2 participants