Skip to content

Conversation

@perher
Copy link
Contributor

@perher perher commented Oct 20, 2025

Second set of subschema improvements taken from #473

This contains three potentially breaking changes to existing code:

  1. fix: anyOf required props only when union

Improves the calculation of required properties for anyOf types, old logic would mark a property as required as long as it was required in one of the subschemas. Proposed solution changes this to mark property as required only when included in all subschemas.

  1. fix: add newline after alias types

Adds newline after alias types, makes generated code more verbose but also more consistent with other types.

  1. fix: only process same schema once

Adds state in generator to prevent duplicate processing of schemas when they are included multiple times for example both from DoFile but then also processed from a ref. Not sure how to unit test, but has at least no impact on existing tests.

Old behavior worked well when unmarshalling, but not so much
when marshalling and emitting all fields even when empty
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@90a1a47). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #481   +/-   ##
=======================================
  Coverage        ?   39.74%           
=======================================
  Files           ?       66           
  Lines           ?     7170           
  Branches        ?        0           
=======================================
  Hits            ?     2850           
  Misses          ?     4041           
  Partials        ?      279           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@perher
Copy link
Contributor Author

perher commented Oct 20, 2025

@omissis second set of changes, with some potential breaking changes. Please let me know what you think.

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