Skip to content

Conversation

@jack-berg
Copy link
Member

On multiple occasions I've tried to use allOf to model polymporphic types only to be reminded that the jsonschema2pojo tool we're using in opentelemetry-java doesn't support anyOf, allOf, oneOf. I suspect this is the case in other languages as well.

I propose we provide modeling guidance to explicitly avoid this tempting trap.

@jack-berg jack-berg requested a review from a team as a code owner December 5, 2024 16:36
@marcalff
Copy link
Member

marcalff commented Dec 5, 2024

On multiple occasions I've tried to use allOf to model polymporphic types only to be reminded that the jsonschema2pojo tool we're using in opentelemetry-java doesn't support anyOf, allOf, oneOf. I suspect this is the case in other languages as well.

I propose we provide modeling guidance to explicitly avoid this tempting trap.

I Agree.

In case of C++, the available tooling is so poor (or nonexistent) that:

  • we are not even using a schema validator
  • we are not using code generated from a schema

Validation of yaml nodes against the schema is done ad-hoc.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM.

Not related to this PR, but I think it is time to split README.md into multiple documents, and have a docs/ subdirectory.

@jack-berg
Copy link
Member Author

Validation of yaml nodes against the schema is done ad-hoc.

That's too bad on the tooling. For what its worth, once the schema is stable, I'm strongly considering ripping out the code generation tooling from opentelemetry-java and maintaining the (previously) generated code by hand instead. Is very similar to the problem with exposing generated proto bindings from opentelemetry-proto as part of your public stable API: you can't guarantee that the code generation tooling won't change in a way that violates the guarantees you make for stable APIs.

@codeboten
Copy link
Contributor

Re. tooling, on the go side i ended up having to split the model generation from the parsing logic, as the parsing code needed to be updated in a couple of places.

I guess this is a good opportunity to help move the json schema ecosystem forward where possible.

@codeboten codeboten merged commit ce60fda into open-telemetry:main Dec 9, 2024
11 checks passed
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.

4 participants