swagger-api / swagger-api/swagger-parser

Parsing error with date default

Open
#1,588 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Hi team,

Please find the attached yml file contents. The Swagger editor validates this yml file to indicate no errors; however, I get the following error when I use the parser to parse this file's contents. Failed. Reason: [attribute paths.'/test/{id}'(get).parameters.[id].schemas.default=2012-12-11T18:30:00.000+0000 is not of type date]

openapi: 3.0.1
info:
  title: hello
  version: "1.0"
servers:
- url: http://abc.com
paths:
  /test/{id}:
    get:
      operationId: get
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: date
            default: "2012-12-12"
      responses:
        200:
          description: OK

I have tried this with swagger-parser-v3-2.0.24. Please let me know if it has already been fixed.

Thanks,
Sree

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied OpenAPI 3.0.1 YAML through swagger-parser-v3-2.0.24 and comparing the result with Swagger Editor. Trace the parser's validation of a string schema with format date and a default value, focusing on why the reported value is treated as a non-date. Done means the discrepancy is explained and the parser behavior is corrected or covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.