additionalProperties does not have to be "either a Boolean or a Schema instance"

See original GitHub issue

Currently, the code enforces that “additionalProperties must be either a Boolean or a Schema instance”.

According to https://swagger.io/docs/specification/data-models/dictionaries/ and https://github.com/OAI/OpenAPI-Specification/issues/668#issuecomment-755415337, the following structure is also valid:

type: object
additionalProperties:
  type: string

This is the openapi that represents (and is generated) when the model is a Map of string and string (Map<String, String>).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
frantumacommented, Jan 6, 2021

I am not sure how you are deserializing and in which scenario, but from your logs it looks like you’re using some possibly not configured ObjectMapper; swagger-core provides helper class Json (and similar Yaml) giving access to a correctly configured mapper which - depending on scenario - you would use e.g. like:

Json.mapper().readValue(openApiAsString, OpenAPI.class);

Please close ticket if this answers your question

0reactions
michaelwangwangwangcommented, Aug 29, 2022

good

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger schema with additionalProperties fails - Stack Overflow
I think your revised schema won't work correctly, because additionalProperties boolean values of true or false are ignored by swagger-core. Apparently this was ......
Read more >
Additional Properties - Liquid Technologies
The value of "additionalProperties" MUST be a boolean or an object. If it is an object, it MUST also be a valid JSON...
Read more >
juniper - npm
Juniper is a JSON Schema generator that focuses on solving two problems: ... Juniper primarily supports Draft 2020-12 JSON Schema, but also ...
Read more >
A Media Type for Describing JSON Documents - JSON Schema
Either this vocabulary or one very much like it is required to write schemas for non-trivial JSON instances, whether those schemas are intended...
Read more >
JSight Schema 0.3 Specification
The PROPERTY KEY essentially is not the VALUE of an object PROPERTY; ... In the RULE additionalProperties , you can specify either a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found