oapi-codegen
oapi-codegen copied to clipboard
Strict server with additionalProperties
The strict server cannot return JSON object with additionalProperties. It seems that wrapper for strict server ignore custom MarshalJSON().
We do not create the minimal test code for this issue yet.
Test code is https://github.com/ShouheiNishi/oapi-codegen/commit/19373ab96086a7d8c6cec20059c918fb2e42db54.
We are also being bitten by this issue.
I also experienced this issue. As a workaround I figured out that if you wrap the schema with the "additionalProerties" tag into a another schema like:
---
components:
schemas:
DataWrapper: # using this will marshal/unmarshal the additionalProperties
type: object
properties:
data:
$ref: "#/components/schemas/WithAdditionalProperies"
example:
data:
fixedProperty: "Hello World"
additionalPropertyFoo: "Bar"
key: "value"
unknown: "known"
WithAdditionalProperies: # using this will NOT marshal/unmarshal the additionalProperties
type: object
properties:
fixedProperty:
type: string
additionalProperty: true ## or {}
example:
fixedProperty: "Hello World"
additionalPropertyFoo: "Bar"
key: "value"
unknown: "known"
it is working.