Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4097
Closed
Open
Issue created Oct 08, 2019 by Administrator@rootContributor

[BUG] spaces in schema.title causes spaces in interface

Created by: snebjorn

Description

When a response title is set and have spaces then the resulting model will also have spaces. Which is not allowed.

export interface Collection of Foo { 
    value?: Array<NAMESPACEFoo>;
}

The definition for schema.title

are taken directly from the JSON Schema definition and follow the same specifications

which is

4.5. Root schema and subschemas

The root schema is the schema that comprises the entire JSON document in question.

Some keywords take schemas themselves, allowing JSON Schemas to be nested:

{
    "title": "root",
    "items": {
        "title": "array item"
    }
}

In this example document, the schema titled "array item" is a subschema, and the schema titled "root" is the root schema.

So spaces in title is valid.

openapi-generator version

"@openapitools/openapi-generator-cli": "^1.0.1-4.1.3"... yes the version is 1.0.1-4.1.3 it's not a range - it's a bit weird. Check https://www.npmjs.com/package/@openapitools/openapi-generator-cli

OpenAPI declaration file content or url
{
  "openapi": "3.0.0",
  "info": {
    "title": "Foo",
    "version": "0001",
    "description": "The description"
  },
  "paths": {
    "/FooSet": {
      "get": {
        "summary": "Get entities from FooSet",
        "responses": {
          "200": {
            "description": "Retrieved entities",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Collection of Foo",
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/NAMESPACE.Foo" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "NAMESPACE.Foo": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "maxLength": 12 }
        },
        "title": "Foo"
      }
    }
  }
}
Command line used for generation

npx openapi-generator generate -g typescript-angular -i openapi.json -o out/test

Steps to reproduce

Generate a client that have a space in paths["/endpoint"].get.responses.200.content.application/json.schema.title

Assignee
Assign to
Time tracking