Skip to content

Add annotations (traits) with schema #51

@Artifizer

Description

@Artifizer

Right now schemas traits are not implemented and not validated right, for example:
https://github.com/GlobalTypeSystem/gts-spec/blob/main/examples/events/schemas/gts.x.core.events.type.v1~.schema.json

  "x-event-type-settings": {
    "additionalProperties": false,
    "topicRef": {
      "description": "ID of the topic where events of this type are stored.",
      "type": "string",
      "x-gts-ref":"gts.x.core.events.topic.v1~"
    }
  },

What we need to do is:

  1. Introduce new OP#12 - validate schema vs parent/base schema(s)

  2. Introduce new standard name for GTS traits, e.g. x-gts-type-trait that will allow to implement traits with automated level merge strategy. The standard libraries will just ignore it, as it's json schema custom annotation (starting with x-)

  3. The GTS libraries can react on it and implement the following validation rules:

  • try to resolve values from right-most schema to the left-most schema layer by layer

  • the final resolved schema must have all the values resolved and have known types for all similarly to what happens when JSON instance is being resolved against it's schema

  • To introduce OP#12 in spec

  • To introduce new API and tests to resolve schema and schema

  • To introduce special x-gts-type-trait keyword in the spec

  • To introduce special x-gts-type-trait keyword in the library, that can be configured by the vendor

  • To introduce proper logic in gts-rust

  • To introduce proper logic in gts-go

  • To introduce proper logic in gts-python

  • To introduce proper logic in gts-ts

  • To introduce proper logic in gts-csharp

  • To introduce proper logic in gts-kit

  • To introduce proper logic in gts-web

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request
No fields configured for Feature.

Projects

Status
No status

Relationships

None yet

Development

No branches or pull requests

Issue actions