Skip to content
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

How versioning of JSON data looks like #231

Closed
wants to merge 21 commits into from

Conversation

albertmink
Copy link
Contributor

@albertmink albertmink commented Sep 14, 2021

Closes #53, closes #83

Discussion and reasoning in #53

	follow argumentation here json-schema/json-schema#220

	The reference to which JSON schema the JSON data belongs shall
be handled by the user, NOT from inside the data.

	Also the validation against a JSON schema, or the mapping from
data to schema shall be handled by the user.

	A convention (not determined by the json-schema) is that the
JSON schema has `$schema`, the JSON data not.
@albertmink albertmink marked this pull request as draft September 14, 2021 15:22
@albertmink albertmink changed the title Amink/version example intf WIP: How version of JSON data could look like Sep 14, 2021
@albertmink albertmink self-assigned this Sep 14, 2021
@albertmink
Copy link
Contributor Author

Q: Where and how do we provide the mapping of JSON data to JSON schema?

Two situation for which the mapping matters:

  • Validation and Annotation in GitHub Actions or Editors -> align with schemastore
  • Implementation of Serialization/Deserialization in ABAP -> consume mapping that is defined in READMEs inside the repository

@albertmink albertmink force-pushed the amink/version-example-intf branch from be357bc to af1ddc7 Compare September 16, 2021 08:44
@albertmink
Copy link
Contributor Author

@albertmink albertmink mentioned this pull request Sep 21, 2021
@albertmink albertmink mentioned this pull request Sep 22, 2021
@albertmink albertmink marked this pull request as ready for review September 22, 2021 09:40
@albertmink albertmink changed the title WIP: How version of JSON data could look like How versioning of JSON data looks like Sep 22, 2021
@albertmink albertmink linked an issue Sep 22, 2021 that may be closed by this pull request
Copy link
Contributor

@wurzka wurzka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two remarks.


The format of object types will evolve over time. If a change to the format is considered incompatible, the version of the file format has to be increased.
The ABAP file format of object types will evolve over time.
For this purpose the JSON schema specifies the field `formatVersion` and the file itself, is named after the version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be $formatVersion? Sorry, if I missed the decision against $.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood that @albertmink don't want to add the $. I was wondering whether it would help to indicate that formatVersion contains meta information about the object. However, both solutions would be fine for me.

One mandatory component of the type is the field `schema` which is translated to `$schema` in the JSON schema.
Its value in the `.json` files is the link given in the field `$id` of the JSON schema.
Furthermore, a `header` has to be supplied.
Fields `formatVersion` and `header` are mandatory on root level.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be more consistent if the field in the ABAP type was called format_version? Then, the generator translates it to ($)formatVersion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Copy link
Contributor

@schneidermic0 schneidermic0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments. Especially, I agree to one of @wurzka's comments

"description": "Format version",
"type": "string"
"const": "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure. Should we also add a type (like number or integer)?
Values would then be changed to 1 instead of "2".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change type to number is bad, because for JSON schema the following representation of integer 1 are equivalent

1 and 1.0 and 1.00 and others

@albertmink
Copy link
Contributor Author

Right now, we miss the adoption of the ABAP types documentation here
https://github.com/SAP/abap-file-formats/blob/main/doc/specification.md#type-specification-example

@albertmink
Copy link
Contributor Author

Decided to close this PR and continue to implement the decisions in #236 #235 #233

@albertmink albertmink closed this Sep 23, 2021
@albertmink albertmink deleted the amink/version-example-intf branch December 16, 2021 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move schema references to a non-Github domain? Versioning
3 participants