Giter Club home page Giter Club logo

openapi-schema-validator's Issues

$ref to other files

Hello !

First thank you for this project and fastify-openapi-glue, it really helps for implementing a documentation-first API ๐Ÿ™‚

I'm currently trying to use fastify-openapi-glue with an OpenAPI definition splitted in multiple files. From what I saw, it raises an error in this package.

If I understand correctly, this package doesn't retrieve the other files and thus I should provide a self-contained definition file ?
Or did I miss something ? ๐Ÿ™‚

Just to give all the infos, I'm using the syntax for getting other files like that:

# OpenAPI file
# [...]
paths:
  /todos:
    $ref: "./list_todos.yaml"

And it fails in https://github.com/seriousme/openapi-schema-validator/blob/master/resolve.js#L33 as there is no # character in the uri, which gives the error Cannot read property 'length' of undefined.

Thanks in advance for the input

Cannot perform validation in strict mode

Using version 1.1.3, I was trying to validate schema using strict mode. It seems so that feature not supported, or in some was is not compatible.

As soon as strict mode enabled fails with error:

Error: unknown format "uri" ignored in schema at path "#/properties/url"
I think error refers not schema I validate but rather different schema
https://json-schema.org/draft/2020-12/schema
or
https://spec.openapis.org/oas/3.1/schema/2021-05-20
not sure.

Typos in ref ids are not detected

Hello, it looks like your library makes a good job in finding the format issues. However, incorrect ref ids are not detected. I'm not sure if it's intended or not.

Version used: 2.1.2

Schema example:

openapi: 3.0.0
info:
  title: test
  version: 1.0.0
paths:
  /get:
    get:
      summary: test
      description: test
      parameters:
        - name: param
          in: query
          description: param
          required: true
          schema:
            type: string
          example: "foo"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/nonExisting1"
components:
  schemas:
    testObject:
      type: object
      properties:
        prop1:
          type: string
    searchResults:
      type: object
      properties:
        testObjects:
          type: array
          items:
            $ref: "#/components/schemas/nonExisting2"

Actual result:
"valid": true
I was using the CLI command for testing: npx -p @seriousme/openapi-schema-validator validate-api "invalid.spec.yaml"

Add local file reference to README

If i have a file file structure like:

api.v0.yaml
v0/auth.v0.yaml

I want to validate api.v0.yaml that references v0/auth.v0.yaml.

  /v0/auth/register:
    post:
      $ref: v0/auth.v0.yaml#/paths/~1v0~1auth~1register/post
      tags:
        - Auth
      summary: Register a new account

I get must NOT have unevaluated properties, which I understand is expected behaviour from the README, I can't figure out how to use <instance>.addSpecRef(subSpecification, uri) to get this working.

Thanks

The method addSpecRef is missing in index.d.ts

Hello and thanks for this useful piece of software!

I'm using the version 2.1.1 in a typescript project. The method addSpecRef is missing in index.d.ts though, so that the typescript compiler complains.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.