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

yamlinc changes example dates when merging #24

Open
StephenNay opened this issue Dec 10, 2019 · 2 comments
Open

yamlinc changes example dates when merging #24

StephenNay opened this issue Dec 10, 2019 · 2 comments
Labels
good first issue Good for newcomers

Comments

@StephenNay
Copy link

Here's a piece of a request definition in one of my source files:

      - name: date
        description: The date
        in: path
        required: true
        schema:
          type: string
          format: date
        example: 2019-12-25

And here's the same section after merging with yamlinc:

        - name: date
          description: The date
          in: path
          required: true
          schema:
            type: string
            format: date
          example: '2019-12-25T00:00:00.000Z'

Note how the example date in the last line has been changed from just the date to a full date and time format, which is not what I want in this case. Is there a way to prevent this from happening?

@francescobianco
Copy link
Member

@StephenNay parsing dates is a known problem of YAML, take a look at this
nodeca/js-yaml#161

to prevent this, my best choice is quoting as a string the date, but if you will work with the custom schema you can do using --schema argument https://github.com/javanile/yamlinc#use-an-external-schema

See more:

@francescobianco francescobianco added the good first issue Good for newcomers label Dec 20, 2019
@darzang
Copy link

darzang commented Oct 30, 2020

I'm also experiencing this issue but with strings that are not in a specific format:
In my base file:

phone:
  type: string
  example: 0102030405

The swagger.inc.yml:

phone:
  type: string
  example: 17314053

What's weird is that I have a postal_code declared the same way:

postal_code:
  type: string
  example: 33130

And in the swagger.inc.yml file the postal_code has the correct value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants