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

Add generator config search & replace substitutions #624

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

tefra
Copy link
Owner

@tefra tefra commented Nov 23, 2021

Add config options for search and replace substitutions for class, field, package, module names based on re.sub and replaced the older aliases. The cli will auto migrate the aliases and emit a warning to verify output!

<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns="http://pypi.org/project/xsdata" version="21.11">
  <Output maxLineLength="79">
    <Package>generated</Package>
    <Format repr="true" eq="true" order="false" unsafeHash="false" frozen="false" slots="false" kwOnly="false">dataclasses</Format>
    <Structure>filenames</Structure>
    <DocstringStyle>reStructuredText</DocstringStyle>
    <RelativeImports>false</RelativeImports>
    <CompoundFields>false</CompoundFields>
  </Output>
  <Conventions>
    <ClassName case="pascalCase" safePrefix="type"/>
    <FieldName case="snakeCase" safePrefix="value"/>
    <ConstantName case="screamingSnakeCase" safePrefix="value"/>
    <ModuleName case="snakeCase" safePrefix="mod"/>
    <PackageName case="snakeCase" safePrefix="pkg"/>
  </Conventions>
  <Substitutions>
    <Substitution type="class" search="Class" replace="Type"/>
    <Substitution type="package" search="http://www.w3.org/2001/XMLSchema" replace="xs"/>
  </Substitutions>
</Config>

@codecov
Copy link

codecov bot commented Nov 23, 2021

Codecov Report

Merging #624 (43b2d31) into master (4cdf92b) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 43b2d31 differs from pull request most recent head 17ad53a. Consider uploading reports for the commit 17ad53a to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            master      #624   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           94        94           
  Lines         8139      8172   +33     
  Branches      1416      1420    +4     
=========================================
+ Hits          8139      8172   +33     
Impacted Files Coverage Δ
xsdata/codegen/handlers/class_designate.py 100.00% <100.00%> (ø)
xsdata/formats/dataclass/filters.py 100.00% <100.00%> (ø)
xsdata/models/config.py 100.00% <100.00%> (ø)
xsdata/models/enums.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cdf92b...17ad53a. Read the comment docs.

@tefra tefra force-pushed the generator-config-substitutions branch 3 times, most recently from d192ab6 to 43b2d31 Compare November 25, 2021 20:36
@tefra tefra force-pushed the generator-config-substitutions branch from 43b2d31 to 17ad53a Compare November 25, 2021 20:45
@tefra tefra merged commit a76175a into master Nov 25, 2021
@tefra tefra deleted the generator-config-substitutions branch November 25, 2021 20:46
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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