-
Notifications
You must be signed in to change notification settings - Fork 96
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
*: allow users to ask for minimal names #324
base: main
Are you sure you want to change the base?
Conversation
@omissis not sure how strongly you are attached to the first := thing
second := other()
if second {
} And instead requiring first := thing
second := other()
if second {
} Is a bit silly :) |
946888b
to
4faca7e
Compare
The new --minimal-names flag allows users to ask the generator to come up with the most minimal name possible, meaning that redundant context prefixes are omitted and collection type names are inferred from field names where possible. A real-world use-case JSON Schema is imported as a test case; some examples of names before and after: RolloutSpecificationOrchestratedStepsElem -> OrchestratedStep RolloutSpecificationOrchestratedStepsElemApplicationsApplyAcrossServiceResources -> ApplyAcrossServiceResources Signed-off-by: Steve Kuznetsov <stekuznetsov@microsoft.com>
4faca7e
to
df9ed50
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #324 +/- ##
==========================================
- Coverage 76.58% 73.32% -3.26%
==========================================
Files 24 43 +19
Lines 1892 2853 +961
==========================================
+ Hits 1449 2092 +643
- Misses 354 588 +234
- Partials 89 173 +84 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
This is fantastic. Looking forward to seeing it work across multiple schema files |
@omissis could you please review this in broad strokes? If you agree with the approach I'll rebase. |
hey @stevekuznetsov sorry for the delay, I was dedicating all my attention to the subschemas implementation and I missed the new contribs :) I will try to look into this as soon as I can! |
@omissis no worries! Once you have cycles to give feedback on the direction of the open PRs I'll respond to comments, etc :) |
The new --minimal-names flag allows users to ask the generator to come up with the most minimal name possible, meaning that redundant context prefixes are omitted and collection type names are inferred from field names where possible.
A real-world use-case JSON Schema is imported as a test case; some examples of names before and after:
RolloutSpecificationOrchestratedStepsElem -> OrchestratedStep RolloutSpecificationOrchestratedStepsElemApplicationsApplyAcrossServiceResources -> ApplyAcrossServiceResources
Fixes #297