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

Query parameter default value not generated to spec file in case of custom types #1472

Closed
2 of 4 tasks
ikkala opened this issue Aug 30, 2023 · 4 comments · Fixed by #1498
Closed
2 of 4 tasks

Query parameter default value not generated to spec file in case of custom types #1472

ikkala opened this issue Aug 30, 2023 · 4 comments · Fixed by #1498
Labels

Comments

@ikkala
Copy link

ikkala commented Aug 30, 2023

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

In case of custom type TimeFormat the following:

type TimeFormat = 'iso8601' | 'epoch_ms';

    @Query()
    timeFormat: TimeFormat = 'iso8601'

should generate open api spec parameter like:

	{
		"in": "query",
		"name": "timeFormat",
		"required": false,
		"schema": {
			"default": "iso8601",
			"type": "string",
			"enum": [
				"iso8601",
				"epoch_ms"
			]
		}
	}

Current Behavior

Instead it generates:

	{
		"in": "query",
		"name": "timeFormat",
		"required": false,
		"schema": {
			"$ref": "#/components/schemas/TimeFormat"
		}
	}

Currently, if type is written open directly into query parameter definition (instead of using custom type):

    @Query()
    timeFormat: 'iso8601' | 'epoch_ms' = 'iso8601'

it works, default value is generated.

Context (Environment)

Version of the library: 5.1.1 and 6.0.0-rc.3
Version of NodeJS: v20.2.0

  • Confirm you were using yarn not npm: [ ]
@github-actions
Copy link

Hello there ikkala 👋

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

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

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Sep 30, 2023
@ikkala
Copy link
Author

ikkala commented Sep 30, 2023

Based on 6.0.0-rc.4 change log, this is still to be fixed.

Copy link

github-actions bot commented Nov 1, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Nov 1, 2023
@github-actions github-actions bot closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant