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

Support ajv-errors in parameter schema #6274

Closed
likexoo opened this issue Sep 4, 2020 · 4 comments
Closed

Support ajv-errors in parameter schema #6274

likexoo opened this issue Sep 4, 2020 · 4 comments
Assignees

Comments

@likexoo
Copy link

likexoo commented Sep 4, 2020

Suggestion

Support ajv-errors in parameter schema.

Use Cases

So we can define custom error message.

Examples

    @get('/v1/test/{_id}')
    public async test(
        @param({
            in: 'path',
            name: '_id',
            schema: {
                type: 'number'
            },
            errorMessage: '....' // <= 
        }) _id: unknown

    ) {
        // ...
    }

Acceptance criteria

TBD - will be filled by the team.

@likexoo likexoo added the feature label Sep 4, 2020
@raymondfeng
Copy link
Contributor

We support ajv-errors for model properties, see https://loopback.io/doc/en/lb4/Model.html#custom-validation-rules-and-error-messages. Do you propose to extend it for OpenAPI parameters?

@likexoo
Copy link
Author

likexoo commented Sep 4, 2020

@raymondfeng Yes and using it in @param.

@raymondfeng
Copy link
Contributor

PR #6285 will probably fix this issue.

@dhmlau
Copy link
Member

dhmlau commented Sep 10, 2020

Closing as done since PR #6285 has landed.

@dhmlau dhmlau closed this as completed Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants