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

Add reference to originating locations in YAML specs - step 1 #1007

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

reuvenharrison
Copy link
Contributor

@reuvenharrison reuvenharrison commented Aug 25, 2024

This PR adds the ability to correlate OpenAPI components with the location in the originating YAML spec.
Here's a summary of the changes required to achieve this:

  1. Modify yaml.v3 to add line and column numbers of each YAML element to the unmarshaled interfaces (see https://github.com/oasdiff/yaml3)
  2. Modify invopop/yaml with a new function: UnmarshalWithOrigin (see https://github.com/oasdiff/yaml)
  3. Modify this repo to add an Origin struct to OpenAPI components. This requires changes to the UnmarshalJSON functions and, in some cases, replacing native types, like map[string]string, by dedicated types that include the original native type and an Origin member.

This PR addresses issue #986

Follow up tasks to be addressed by future PRs:

  • Add origin to more elements, namely Components and some types that are unmarshalled with unmarshalStringMapP or unmarshalStringMap
  • Merge changes in yaml.v3 and invopop/yaml back to original repos and remove replace directives from go.mod
  • Enhance origin to include end line and column and YAML comments as proposed by @fenollp

@reuvenharrison reuvenharrison marked this pull request as ready for review September 21, 2024 07:56
@reuvenharrison reuvenharrison changed the title Correlate OpenAPI components with their location in the originating YAML spec Add reference to originating locations in YAML specs - step 1 Sep 21, 2024
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.

1 participant