cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Complex child properties defined with string keys #76

Closed ak99372 closed 4 years ago

ak99372 commented 4 years ago

Not sure if this is intended but following schema

"ApplicationInfoResult": {
        "type": "object",
        "properties": {
          "Name": {
            "type": "string"
          },
          "Authentication": {
            "type": "object",
            "properties": {
              "base": {
                "required": true,
                "type": "boolean"
              },
              "advanced": {
                "required": true,
                "type": "boolean"
              },
              "pro": {
                "required": true,
                "type": "boolean"
              }
            }
          }
        },
        "required": [
          "Version",
          "Name",
          "Authentication"
        ]
      }

Generates:

export interface ApplicationInfoResult {
  Authentication: { 'base'?: boolean, 'advanced'?: boolean, 'pro'?: boolean };
  Name: string;
}

Notice the child properties defined through string 'keys' (which shouldn't be necessary) plus while all are required they are flagged as optional (?)

luisfpg commented 4 years ago

There's no practical difference between {a: string} and {'a': string}. So, I don't see the point. Also, the properties are optional because they are not listed in a required array.