swagger-api / swagger-api/swagger-parser

parsing a v3.1.0 spec omits defined minLength

Open
#1,800 0 comments 0 reactions 1 assignee View on GitHub

@gracekarina is already working on this.

Since Sep 28, 2022.

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

Description

swagger-parser version: 2.1.1
spec: defined below below

Issue:
parsing of component schema MinLengthValidationWithADecimal omitsthe existing minLength from the parser result

Here is the pasted parser result for that schema:

MinlengthValidationWithADecimal -> {JsonSchema@4942} "class JsonSchema {
    class Schema {
        type: null
        format: null
        $ref: null
        description: null
        title: null
        multipleOf: null
        maximum: null
        exclusiveMaximum: null
        minimum: null
        exclusiveMinimum: null
        maxLength: null
        minLength: null
        pattern: null
        maxItems: null
        minItems: null
        uniqueItems: null
        maxProperties: null
        minProperties: null
        required: null
        not: null
        properties: null
        additionalProperties: null
        nullable: null
        readOnly: null
        writeOnly: null
        example: null
        externalDocs: null
        deprecated: null
        discriminator: null
        xml: null
        patternProperties: null
        contains: null
        $id: null
        $anchor: null
        $schema: https://json-schema.org/draft/2020-12/schema
        const: null
        contentEncoding: null
        contentMediaType: null"

spec:

openapi: 3.1.0
servers:
- url: https://someserver.com/v1
info:
  title: openapi 3.1.0 sample spec
  version: 0.0.1
  description: sample spec for testing openapi functionality, built from json schema
    tests for draft2020-12
tags: []
paths: {}
components:
  schemas:
    MinlengthValidationWithADecimal:
      $schema: https://json-schema.org/draft/2020-12/schema
      minLength: 2.0

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.