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

Output Message - Differenciate the container from its content #520

Closed
Amachua opened this issue Sep 4, 2019 · 1 comment · Fixed by #622
Closed

Output Message - Differenciate the container from its content #520

Amachua opened this issue Sep 4, 2019 · 1 comment · Fixed by #622
Assignees
Labels
enhancement New feature or request

Comments

@Amachua
Copy link
Contributor

Amachua commented Sep 4, 2019

User story.
As a API Designer, When I defined a field that doesn't match a regular expression, Then the value of the property can be prompted in the output.

Additional information

When I use the following OpenAPI specification

openapi: 3.0.0

x-format-version: "1.0"

info:
  title: Dummy title
  description: Dummy description
  version: 1.0.0

paths:
  /some/path:
    get:
      description: Dummy description
      parameters:
        - in: header
          name: some_header
          description: Some header description.
          schema:
            type: string
        - in: header
          name: someHeader
          description: Some header description.
          schema:
            type: string
        - in: header
          name: some-header
          description: Some header description.
          schema:
            type: string
      responses:
        "200":
          description: All is good

And I use the following rule:

  header-parameter-names-kebab-case:
    type: style
    severity: error
    recommended: true
    description: A parameter in the header should be written in kebab-case
    message: "'{{property.value}}' is not kebab-cased: {{error}}"
    given: $..parameters[?(@.in === 'header')]
    then:
      field: name
      function: pattern
      functionOptions:
        match: ^[a-z0-9]+((-[a-z0-9]+)+)?$

Then I would like to have as output something like this:

   16:17     error  [header-parameter-names-kebab-case] 'some_header' is not kebab-cased: must match the pattern '^[a-z0-9]+((-[a-z0-9]+)+)?$'
      -> paths,/some/path,get,parameters,0,name
   21:17     error  [header-parameter-names-kebab-case] 'someHeader' is not kebab-cased: must match the pattern '^[a-z0-9]+((-[a-z0-9]+)+)?$'
      -> paths,/some/path,get,parameters,1,name

At the end I would like to have another property (property.value in the sample) that can be used in the message in addition to the existing ones (property, error and description if I'm not wrong) and that can be use to give back the value of the field (easier for a functional to understand the output message).

If the issue is unclear, please do not hesitate to ask for more information. :)

@P0lip P0lip added the enhancement New feature or request label Sep 4, 2019
@P0lip
Copy link
Contributor

P0lip commented Sep 4, 2019

@Amachua

If the issue is unclear, please do not hesitate to ask for more information. :)

Everything is clear, no worries :)
I believe that having an access to value of property would be very beneficial for everyone, therefore I'm willing to implement this as a part of the next release. Stay tuned.

@P0lip P0lip self-assigned this Sep 4, 2019
@philsturgeon philsturgeon added this to the Oct '19 milestone Sep 9, 2019
@P0lip P0lip closed this as completed in #622 Oct 8, 2019
@P0lip P0lip removed this from the Oct '19 milestone May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants