SAP / abap-file-formats

File formats that define and specify the file representation for ABAP development objects
MIT License
58 stars 55 forks source link

Discussion: JSON Schema and the field `$id` #239

Closed albertmink closed 1 year ago

albertmink commented 3 years ago

Actually, the JSON Schema is designed to have a $id that reflects its url/path in the repository, see here https://github.com/SAP/abap-file-formats/blob/1977c2da2c7d285313a5c18408f1579a8d57dff4/file-formats/intf/intf-v1.json#L4

We could easily drop it, as we have no plans of using the $id in the JSON Schema. But the JSON Schema specification of $id says

The root schema of a JSON Schema document SHOULD contain an "$id" keyword with an absolute-URI (containing a scheme, but no fragment).

see https://json-schema.org/draft/2020-12/json-schema-core.html#id-keyword Maybe we should provide a simpler and canonical $id.

I am welcome to any suggestions on that one!

larshp commented 3 years ago

my POV: skip it for now, I'm not really sure what/if its useful for

schneidermic0 commented 2 years ago

I found following information that we might want to consider:

The root schema of a JSON Schema document SHOULD contain an "$id" keyword with an absolute-URI (containing a scheme, but no fragment).

See https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1.1

... Note that this URI is an identifier and not necessarily a network locator. In the case of a network-addressable URL, a schema need not be downloadable from its canonical URI. ...

See https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.8.2.1

... Informatively, the initial base URI of a schema is the URI at which it was found, whether that was a network location, a local filesystem, or any other situation identifiable by a URI of any known scheme. If a schema document defines no explicit base URI with "$id" (embedded in content), the base URI is that determined per RFC 3986 section 5. ...

see https://json-schema.org/draft/2020-12/json-schema-core.html#initial-base

albertmink commented 1 year ago

Stale issue ➡️ closing