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

Added the ability to define an explicit type with $corvusTypeName. #366

Merged
merged 3 commits into from
May 14, 2024

Conversation

mwadams
Copy link
Contributor

@mwadams mwadams commented May 14, 2024

If you add a $corvusTypeName keyword to a schema and give it a string value, it will be used as the basis for the type name of the schema, overriding the default naming convention.

If the value is present, and is a string of Length >= 1, it will converted into a PascalCased basis for the type name.

Naming collisions will still be resolved in the usual way.

For example:

File: test.json

{
    "type": "array",
    "prefixItems": [
        {
            "$corvusTypeName": "PositiveInt32",
            "type": "integer",
            "format": "int32",
            "minimum": 1
        },
        { "type": "string" },
        {
            "type": "string",
            "format": "date-time"
        }
    ],
    "unevaluatedItems": false
}
generatejsonschematypes --rootNamespace JsonSchemaSample.Api --outputPath Model test.json
Generating: PositiveInt32
Generating: Test

Copy link

Code Coverage Summary Report - Linux (net8.0)

Code Coverage

Package Line Rate Branch Rate Complexity Health
Corvus.Json.JsonSchema.Draft7 14% 14% 8051
Corvus.Json.CodeGeneration.201909 31% 18% 27044
Corvus.Json.Patch 25% 21% 4237
Corvus.Json.JsonSchema.Draft6 14% 14% 7329
Corvus.Json.JsonSchema.Draft202012 15% 14% 11933
Corvus.Json.CodeGeneration.202012 31% 18% 27351
Corvus.Json.CodeGeneration.6 32% 18% 21372
Corvus.Json.CodeGeneration.Abstractions 86% 75% 1299
Corvus.Json.JsonSchema.Draft201909 14% 14% 12408
Corvus.Json.CodeGeneration.7 31% 18% 23584
Corvus.Json.ExtendedTypes 39% 33% 17107
Corvus.Json.Specs 98% 79% 4618
Summary 35% (75475 / 216080) 20% (26655 / 135779) 166333

Copy link

github-actions bot commented May 14, 2024

Test Results

     1 files       1 suites   16m 57s ⏱️
11 211 tests 11 211 ✅ 0 💤 0 ❌
12 259 runs  12 259 ✅ 0 💤 0 ❌

Results for commit c1ff0cc.

♻️ This comment has been updated with latest results.

Copy link

Code Coverage Summary Report - Windows (net481)

Code Coverage

Package Line Rate Branch Rate Complexity Health
Corvus.Json.Patch 27% 23% 3945
Corvus.Json.JsonSchema.Draft7 15% 15% 7543
Corvus.Json.JsonSchema.Draft6 15% 15% 6862
Corvus.Json.JsonSchema.Draft201909 15% 15% 11715
Corvus.Json.CodeGeneration.6 32% 18% 21374
Corvus.Json.CodeGeneration.7 31% 18% 23586
Corvus.Json.CodeGeneration.201909 31% 18% 27047
Corvus.Json.CodeGeneration.202012 31% 18% 27354
Corvus.Json.JsonSchema.Draft202012 16% 16% 11277
Corvus.Json.ExtendedTypes 39% 36% 11333
Corvus.Json.CodeGeneration.Abstractions 87% 75% 1291
Corvus.Json.Specs 98% 81% 4344
Summary 35% (72343 / 206356) 20% (25091 / 127759) 157671

Copy link

Code Coverage Summary Report - Windows (net8.0)

Code Coverage

Package Line Rate Branch Rate Complexity Health
Corvus.Json.Patch 25% 21% 4237
Corvus.Json.JsonSchema.Draft7 14% 14% 8051
Corvus.Json.JsonSchema.Draft6 14% 14% 7329
Corvus.Json.JsonSchema.Draft202012 15% 14% 11933
Corvus.Json.JsonSchema.Draft201909 14% 14% 12408
Corvus.Json.CodeGeneration.6 32% 18% 21372
Corvus.Json.CodeGeneration.7 31% 18% 23584
Corvus.Json.CodeGeneration.201909 31% 18% 27044
Corvus.Json.CodeGeneration.202012 31% 18% 27351
Corvus.Json.ExtendedTypes 39% 33% 17107
Corvus.Json.CodeGeneration.Abstractions 86% 75% 1299
Corvus.Json.Specs 98% 79% 4618
Summary 35% (75506 / 216080) 20% (26682 / 135779) 166333

@mwadams mwadams merged commit 8542c20 into main May 14, 2024
9 checks passed
@mwadams mwadams deleted the feature/corvus-type-name-keyword branch May 14, 2024 14:55
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