-
Notifications
You must be signed in to change notification settings - Fork 2
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
Ignores additional properties by default #29
Conversation
This adds a config field `ignoreAdditionalProperties` which is defaulted to `True`. When code gen encounters `additionalProperties: false`, we now ignore it or produce an error based on the value of that config field.
@@ -34,6 +34,7 @@ let | |||
baseConfig = | |||
{ defaultTypeOptions = TypeOptions.default | |||
, typeOptions = [] : List SpecificTypeOptions | |||
, ignoreAdditionalProperties = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the config name is misleading, and also it should not default to True
. The default behavior for fleece should not be a setting that doesn't following the OpenAPI spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name was changed to strictAdditionalProperties
in 0b7d610
.
data MixedInAdditionalPropertiesFalse = MixedInAdditionalPropertiesFalse | ||
{ bar :: Maybe Bar.Bar | ||
, foo :: Maybe Foo.Foo | ||
, additionalProperties :: (Map.Map T.Text FC.AnyJSON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not generate code to process additional properties for an item that has additionalProperties: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was fixed in 0b7d610
.
This modifies the previous commit to generate no code when the `additionalProperties` field is set to `false`. The relevavnt config field has been renamed to `strictAdditionalProperties`, with the value determining the behavior when the `additionalProperties` field is `false`: - `True`: We raise an error. - `False`: We ignore the field and generate no code for it.
This adds a config field
ignoreAdditionalProperties
which is defaulted toTrue
. When code gen encountersadditionalProperties: false
, we now ignore it or produce an error based on the value of that config field.