Stop generating an undocumented case for enums/oneOfs #204
Labels
area/openapi
Adding/updating a feature defined in OpenAPI.
kind/bug
Feature doesn't work as expected.
Consider not generating an undocumented case for enums/oneOfs by default.
It seemed like a good idea to generate the undocumented case before, as it allows for API evolution - as adding an enum or oneOf case maybe shouldn't be a breaking change.
However, OpenAPI/JSON Schema enums/oneOfs are closed by default, so we're actually diverging from the specification here.
And it's causing issues when these enums/oneOfs are nested within other allOfs/oneOfs/anyOfs and it "successfully" parses even though it parses into an undocumented case.
Talk about this more, but we might need to undo this, and follow the specification closely, and also generate closed enums by default. Possibly it could be an option to generate an undocumented case? Or we should document that open enums can be represented as:
And an open oneOf with:
And as an adopter, you first check the first schema if it's not nil. If it's not nil, the closed enum/oneOf parsed successfully. If the first element is nil, the second will be filled in, which is the fallback value.
The text was updated successfully, but these errors were encountered: