Skip to content

feat: Allow clashing types ref (controlled via Reflector.NamesWithPkg option)#107

Closed
candiduslynx wants to merge 5 commits intoinvopop:mainfrom
cloudquery:feat/full-pkg-path-for-id
Closed

feat: Allow clashing types ref (controlled via Reflector.NamesWithPkg option)#107
candiduslynx wants to merge 5 commits intoinvopop:mainfrom
cloudquery:feat/full-pkg-path-for-id

Conversation

@candiduslynx
Copy link
Copy Markdown
Contributor

No description provided.

@candiduslynx candiduslynx changed the title feat: Allow clashing types ref feat: Allow clashing types ref (controlled via Reflector.NamesWithPkg option) Oct 3, 2023
@candiduslynx candiduslynx marked this pull request as draft October 3, 2023 16:53
@candiduslynx candiduslynx marked this pull request as ready for review October 3, 2023 17:59
@candiduslynx
Copy link
Copy Markdown
Contributor Author

candiduslynx commented Oct 3, 2023

@samlown this just allows the schema to use advanced names.
Additionally, the pkg path is escaped to be a valid JSON pointer.

I've successfully tested (via https://pkg.go.dev/github.com/santhosh-tekuri/jsonschema/v5) the resulting schema for testdata.Odd with the following input:

{
  "dummy1": {"A":"str"},
  "dummy2": {"B":12345}
}

An alternative to this could be replacing all / & ~ symbols with underscores or defined char, but it'll be prone to clash in the following case:

root
⌞_ pkg
   ⌞_ another_pkg
⌞_ pkg_another
   ⌞_ pkg

P.S.: using . instead of / & ~ might just work, though

@candiduslynx
Copy link
Copy Markdown
Contributor Author

@samlown I propose reviewing this one before #106, as this will make the diff for #106 much shorter & easier to review

@candiduslynx
Copy link
Copy Markdown
Contributor Author

Replaced by #109

@candiduslynx candiduslynx deleted the feat/full-pkg-path-for-id branch October 6, 2023 09:14
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