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

*: allow users to ask for minimal names #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stevekuznetsov
Copy link
Contributor

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

@stevekuznetsov
Copy link
Contributor Author

@omissis not sure how strongly you are attached to the wsl linter and the rules on "cuddling" but if I may give some feedback - the utility of that type of linting can be extremely low. Not allowing:

first := thing
second := other()
if second {

}

And instead requiring

first := thing

second := other()
if second {

}

Is a bit silly :)

@stevekuznetsov stevekuznetsov force-pushed the skuznets/names branch 6 times, most recently from 946888b to 4faca7e Compare November 19, 2024 17:48
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>
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.32%. Comparing base (d963216) to head (df9ed50).
Report is 96 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@bbrcan
Copy link

bbrcan commented Nov 19, 2024

This is fantastic. Looking forward to seeing it work across multiple schema files

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.

Possible to not prefix names?
2 participants