Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Support additional properties of incoming messages #16

Open
3 tasks
ignasi35 opened this issue Apr 26, 2017 · 0 comments
Open
3 tasks

Support additional properties of incoming messages #16

ignasi35 opened this issue Apr 26, 2017 · 0 comments

Comments

@ignasi35
Copy link
Contributor

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:

  1. strict parsing fails when new fields arrive
  2. liberal parsing doesn't fail
  3. 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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant