Skip to content

Implemented support for recursive $ref #43

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

Closed
wants to merge 6 commits into from
Closed

Conversation

milux
Copy link

@milux milux commented Aug 14, 2024

This PR implements parsing and codegen for recursive $refs.
It requires pwall567/json-kotlin-schema#20 or another patched version of json-kotlin-schema that properly creates cyclic schema objects.

The cycle detection strategy is not very pretty, yet effective.
I tried to implement it as efficiently as possible. Each affected function call along the tracked call chains will have one more reference parameter. Apart from the check for the existence of an element in the call chain, which naturally is O(n) with n being the depth of the relevant call stack, the add/removeLast ops are all O(1).
Using HashSets/HashMaps may further improve performance for deep call stacks due to all ops being O(1) there, but due to higher costs of each operation I considered simple (Array)Lists the better option.

@milux
Copy link
Author

milux commented Aug 16, 2024

PR is still relevant, but base changed to https://github.com/milux/json-kotlin-schema-codegen/tree/feature/recursive-refs
Edit: Thought that renaming the branch in my repo for clarity would also cause changing the base branch here. This obviously didn't work. If desired, I can open a new PR with the right pointers.

@milux milux reopened this Aug 16, 2024
@milux
Copy link
Author

milux commented Aug 21, 2024

Tracked in #46

@milux milux closed this Aug 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