Skip to content

Conversation

@jack-berg
Copy link
Member

Alternative to #400 which uses tooling to produce JSON schema files enriched with descriptions from the meta schema.

Main advantage here is that we can include descriptions which are a combination of bits of information from the meta schema:

@@ -0,0 +1,253 @@
{
"$id": "https://opentelemetry.io/otelconfig/common.json",
Copy link
Member Author

Choose a reason for hiding this comment

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

Showing these output files for demonstration purposes, but if we go in this direction, maybe we don't check these into git, but include them as release artifacts

Copy link
Contributor

Choose a reason for hiding this comment

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

after thinking about this more, i think we would definitely want to have whatever the current version is checked in

Copy link
Member Author

Choose a reason for hiding this comment

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

I could also setup the tooling to directly modify the schema JSON files in place. This would also help ensure consistent formatting (i.e. indenting), and is akin to gofmt, prettier, spotless.

Copy link
Member Author

Choose a reason for hiding this comment

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

A short script which:

  • Reads all the JSON schema files into memory
  • Walks through all the types and properties from the meta schema and for each:
    • Finds the appropriate JSON schema file, type definition, and property definition, and updates the JSON to set description from the meta schema

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

I would suggest that if this is the desired direction, we should remove the json schema and represent the data in yaml as the source of truth.

One problem with moving away from the source schema altogether is that the yaml and tooling then needs to be able to represent any relationship that json schema does, which may cost more down the road if we find new ways to use the schema that we have yet to implement.

Having both yaml and json schema be combined to produce another json makes it harder to make understand how this all works together.

@@ -0,0 +1,253 @@
{
"$id": "https://opentelemetry.io/otelconfig/common.json",
Copy link
Contributor

Choose a reason for hiding this comment

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

after thinking about this more, i think we would definitely want to have whatever the current version is checked in

@jack-berg
Copy link
Member Author

One thing to think about is that even if we embed description in the JSON schema, I don't think we'll fully be able to get rid of the meta schema files, since the meta_schema_language_{language}.yaml files have significant maintenance benefits compared to embedding the information directly in the JSON schema.

I would suggest that if this is the desired direction, we should remove the json schema and represent the data in yaml as the source of truth.

In this case, we'd need to publish the schema in JSON format. Correct?

One problem with moving away from the source schema altogether is that the yaml and tooling then needs to be able to represent any relationship that json schema does

Not sure I'm following. Can you elaborate?

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.

2 participants