Skip to content
GitLab
    • Explore Projects Groups Snippets
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 5 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

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

Closed

[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

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0

No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
2
Client: TypeScript Issue: Bug
2
Client: TypeScript Issue: Bug
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
1
1 participant
Administrator
Reference: OpenAPITools/openapi-generator#4097

Menu

Explore Projects Groups Snippets