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

Generated class name might be lower case in 14.0 #4837

Open
WolfgangHG opened this issue Mar 25, 2024 · 2 comments
Open

Generated class name might be lower case in 14.0 #4837

WolfgangHG opened this issue Mar 25, 2024 · 2 comments

Comments

@WolfgangHG
Copy link

I have a yaml file (unfortunately is not public, so I cannot post it here). With 14.0.4, some of the generated class names start with a lowercase letter, while they had before uppercase names.

Here is a yaml snippet:

  VariableDatenStandalone:
    type: "object"
    properties:
      dienstnehmer:
        $ref: "#/definitions/DienstnehmerRef"
      variableDaten:
        type: "array"
        items:
          type: "object"
          properties:
            validFrom:
              type: "string"
              format: "date"
              example: "2019-01-15"
            data:
              $ref: "#/definitions/VariableDaten"

"definitions/VariableDaten" is defined like this:

  VariableDaten:
    type: "object"
    properties:
      validFrom:
        type: "string"
        format: "date"
        example: "2019-01-15"
      dnGruppe:
        type: "object"
        properties:
          kz:
            type: "string"
            example: "ANG"
          name:
            type: "string"
            example: "Angestellter"
      lohnsteuer:
        type: "object"
        properties:
           ...

The generated code looks like this:

    [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.4.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
    public partial class VariableDatenStandalone
    {
        [Newtonsoft.Json.JsonProperty("dienstnehmer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public DienstnehmerRef Dienstnehmer { get; set; }

        [Newtonsoft.Json.JsonProperty("variableDaten", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public System.Collections.Generic.ICollection<variableDaten> VariableDaten { get; set; }

    }

    [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.4.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
    public partial class variableDaten
    {
        [Newtonsoft.Json.JsonProperty("validFrom", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        [Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter))]
        public System.DateTimeOffset? ValidFrom { get; set; }

        [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public VariableDaten Data { get; set; }

    }

    [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.4.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
    public partial class VariableDaten
    {
        [Newtonsoft.Json.JsonProperty("validFrom", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        [Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter))]
        public System.DateTimeOffset? ValidFrom { get; set; }

        [Newtonsoft.Json.JsonProperty("dnGruppe", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public DnGruppe DnGruppe { get; set; }

        [Newtonsoft.Json.JsonProperty("lohnsteuer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public Lohnsteuer Lohnsteuer { get; set; }

        .....

I don't like the situation that a class name exists in a lower and upper case version. With 13.0.20, the class "variableDaten" was named "VariableDaten3" - not much better, but at least it didn't look strange ;-).

This might be a problem with VB.NET I think - here casing does not matter as far as I know.

If you don't consider it relevant enough to look at, please close this issue.

@RicoSuter
Copy link
Owner

RicoSuter commented Mar 26, 2024

Please retry with v14.0.7

@WolfgangHG
Copy link
Author

@RicoSuter Did not change in 14.0.7, I deleted the generated cs file after updating, and the regenerated file still has lower case class names.

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

No branches or pull requests

2 participants