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

Rust: Cycle detection and Boxing needs to check recursively #382

Closed
BelfordZ opened this issue Jun 11, 2021 · 2 comments
Closed

Rust: Cycle detection and Boxing needs to check recursively #382

BelfordZ opened this issue Jun 11, 2021 · 2 comments
Labels

Comments

@BelfordZ
Copy link
Member

ATM the 'to box or not to box' is too simplistic. We need to know if there is a cycle at play, and if so, always box. The cycles can exist in subschema branches, and so the simplistic approach isnt working for json-schema meta schema.

There are multiple approaches with varying complexity to implement.

  1. Box everything
  2. Box all refs to struct or enums. Still requires checking the inside of things instead of just pulling the title from the ref, but only 1 level deep still.
  3. Hook into traverse method as its running, passing along the isCycle param. Codegen methods can then handle boxing themselves if they are part of a cycle.
  4. while doing initial processing, create a map that holds schema.title -> is a cycle. Use this map later to decide if you should box or not.
@BelfordZ
Copy link
Member Author

BelfordZ commented Jun 11, 2021

note: if the reference is used in a HashMap or Vec, boxing is not required (already boxed)

BelfordZ added a commit that referenced this issue Jun 17, 2021
BelfordZ pushed a commit that referenced this issue Jun 17, 2021
# [1.9.0](1.8.2...1.9.0) (2021-06-17)

### Bug Fixes

* add return types to most of the utils ([75b3245](75b3245))
* clean up remenants of bad ideas ([9d0ef32](9d0ef32))
* run lint fix ([9a2d65e](9a2d65e))
* update deps and regen package-lock ([6ea95ee](6ea95ee))

### Features

* augment schemas with isCycle ([07d7015](07d7015)), closes [#382](#382)
@BelfordZ
Copy link
Member Author

🎉 This issue has been resolved in version 1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant