Giter VIP home page Giter VIP logo

Comments (6)

devjack avatar devjack commented on May 14, 2024

I've implemented a similar JSON ref parser in python in this project & code. This may help as a reference example.

from oas-kit.

devjack avatar devjack commented on May 14, 2024

Seems that the when resolving external references here and here it falls back to resolveInternal() which in tern calls jptr.jptr(root, pointer) here.

Cursory search shows jptr implements ~1 parsing properly.

from oas-kit.

devjack avatar devjack commented on May 14, 2024

In trying to develop a simple test case for this I also found that the components/schemas/<name> validation is too specific, not allowing / characters:

e.g.

openapi: 3.0.0
info:
    title: Example API
    description: Tests ~1 resolving in ref
    version: 0.0.1

servers:
  - url: 'https://localhost:8080/'
    description: Example
paths:
    "/":
        get:
          responses:
            '200':
              description: Example
              content:
                application/json:
                  schema:
                    type: array
                    items:
                      $ref: '#/components/schemas/Example~1Respnse'

components:
    schemas:
        "Example/Response":
            required:
                - Id
            properties:
              Id:
                type: string
                format: uuid
                example: "d2014f64-ffdf-487b-8d12-67a20976aca6"

Resulting in:

Gathering...
#/components/schemas/Example/Response
component name invalid
examples/pathrefs.yml
  Example API 0.0.1
  https://localhost:8080/

Failures:
examples/pathrefs.yml

from oas-kit.

MikeRalphson avatar MikeRalphson commented on May 14, 2024

/ is not valid in a component name.

"All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$"

Sorry for being terse, on my phone.

from oas-kit.

MikeRalphson avatar MikeRalphson commented on May 14, 2024

Re: the first point, did you install v2.7.0 from npm, or update a git clone? If the latter, you may need to npm i to bring in the latest version of jgexml / jptr.

from oas-kit.

devjack avatar devjack commented on May 14, 2024

@MikeRalphson you're spot on here. Turns out it's not the pointer but the external resolution. I'll open a separate issue w/ details and a partial solution.

from oas-kit.

Related Issues (20)

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.