Why does the generated Java models all have additionalProperties
?
#675
-
Why does the generated Java models all have |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I assume you are generating models either from AsyncAPI, OpenAPI, or raw JSON schema inputs. The reason it is generated is that is what you allow in your input schema, by default in JSON Schema draft 7 Modelina generates the property so you have a way to set the additional properties at runtime. To disable it, explicitly set the schema to {"type": "object", "properties": {...}, "additionalProperties": false, ... } Whether we should support something like a global setting that disable this logic, I would love to hear your reasoning for it 🙂 |
Beta Was this translation helpful? Give feedback.
-
Oh. Actually had no idea that was the default. Nothing I had encountered before from other generators. Thank you :) |
Beta Was this translation helpful? Give feedback.
I assume you are generating models either from AsyncAPI, OpenAPI, or raw JSON schema inputs.
The reason it is generated is that is what you allow in your input schema, by default in JSON Schema draft 7
additionalProperties
aretrue
allowing input JSON to contain properties beyond what you define within{properties: {...}}
. 🙂Modelina generates the property so you have a way to set the additional properties at runtime.
To disable it, explicitly set the schema to
additionalProperties: false
Whether we should support something like a global setting that disable this logic, I would love to hear your reasoning for it 🙂