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

Key of schema with $ are generated, but $ is invalid character. #1507

Closed
2 of 4 tasks
bigen1925 opened this issue Nov 8, 2023 · 4 comments
Closed
2 of 4 tasks

Key of schema with $ are generated, but $ is invalid character. #1507

bigen1925 opened this issue Nov 8, 2023 · 4 comments

Comments

@bigen1925
Copy link

Key of schema with $ is generated when $ is in type name, but $ is invalid in schema name.

refs) https://swagger.io/specification/#:~:text=All%20the%20fixed%20fields%20declared%20above%20are%20objects%20that%20MUST%20use%20keys%20that%20match%20the%20regular%20expression%3A%20%5E%5Ba%2DzA%2DZ0%2D9%5C.%5C%2D_%5D%2B%24.

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

$ (the only character that can be used in ES identifier and invalid in openapi key ) should be replaced with _ or . or -

When type definition is

type $DollarType = string;

, generated spec is expected like

{
  "components": {
    "schemas": {
      "_DollarType": {
        "type": "string"
      }
    }
  }
}

Current Behavior

When type definition is

type $DollarType = string;

, generated spec is

{
  "components": {
    "schemas": {
      "$DollarType": {
        "type": "string"
      }
    }
  }
}

Possible Solution

replace $

Steps to Reproduce

https://github.com/bigen1925/tsoa-schema-key-with-dollar

Context (Environment)

Version of the library: 6.0.0-rc.4
Version of NodeJS: v18.15.0

  • Confirm you were using yarn not npm: [x]

Detailed Description

nothing

Breaking change?

may be NO.

Copy link

github-actions bot commented Nov 8, 2023

Hello there bigen1925 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

@bigen1925
Copy link
Author

This is relevant to #1468

@WoH
Copy link
Collaborator

WoH commented Nov 25, 2023

Can you check with tsoa@next? This should be solved

@bigen1925
Copy link
Author

@WoH
I confirmed this is solved in tsoa@next !

Thank you so much!

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