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

Fix Map and byte[] for openapi #2512

Merged
merged 1 commit into from Jan 27, 2022
Merged

Fix Map and byte[] for openapi #2512

merged 1 commit into from Jan 27, 2022

Conversation

Xerxekyran
Copy link
Contributor

This pull requests contains two fixes when generating the openapi defintion using jooby-openapi:

Fix for Map:
According to https://swagger.io/docs/specification/data-models/dictionaries/ a map should be represented by a schema that has the type as well as an additionalProperties element with the type property set to the value property of the map.

So the following map

{
  "en": "English",
  "fr": "French"
}

should become the following schema:

type: object
  additionalProperties:
    type: string

Fix for byte[]:
There exists a special ByteArraySchema class that can be used in this case, as it produces the correct schema for it:

schema": {
  "type": "string",
  "format": "byte"
}

what
- return the special ByteArraySchema for byte[] types
- return a MapSchema with correct additionalProperties
schema set for map types
@Xerxekyran
Copy link
Contributor Author

Shall I rebase the branch or fix the checkstyle problem that was introduced two days ago?

@jknack
Copy link
Member

jknack commented Jan 27, 2022

Fixed it. Thanks.

Build is running again

@jknack jknack added this to the 2.13.1 milestone Jan 27, 2022
@jknack jknack added the openapi label Jan 27, 2022
@jknack jknack merged commit 5821214 into jooby-project:2.x Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants