Applying Postel's Law parsing a message should be liberal. JsonSchema supports setting up the additonalProperties flag to control that. Enumerated fields may also increase the set of valid values ("male"/"female" v "male"/"female"/"won't disclose").
There are three possible scenarios:
strict parsing fails when new fields arrive
liberal parsing doesn't fail
liberal parsing doesn't fail and includes the additionalFields as an extra data in the parsed objects (final Map<String,Object> additionalFields)
As a general rule, the generated code should be robust to exta fields arriving on a message (options 2 and 3). This issue is to implement code generators that are liberal and also to discuss whether extra info should be made available to users (3) or simply swallowed (2).
[ ] the generated code should allow for liberal parsing (must do)
[ ] generating code from swagger should honour the value of additionalProperties (may do)
[ ] add an UNKNOWN field on enums so that parsing new values in the set doesn't cause issues. This is not explicitly supported in jsonSchema. (may do)
Applying Postel's Law parsing a message should be liberal. JsonSchema supports setting up the
additonalProperties
flag to control that. Enumerated fields may also increase the set of valid values ("male"/"female" v "male"/"female"/"won't disclose").There are three possible scenarios:
final Map<String,Object> additionalFields
)As a general rule, the generated code should be robust to exta fields arriving on a message (options 2 and 3). This issue is to implement code generators that are liberal and also to discuss whether extra info should be made available to users (3) or simply swallowed (2).
additionalProperties
(may do)UNKNOWN
field on enums so that parsing new values in the set doesn't cause issues. This is not explicitly supported in jsonSchema. (may do)