json-schema-ref-parser icon indicating copy to clipboard operation
json-schema-ref-parser copied to clipboard

add more details on missing $ref

Open AlexHolly opened this issue 5 years ago • 2 comments

Example Current infos: https://apitools.dev/swagger-parser/online/

openapi: 3.0.2
info:
  description: >-
    This is a sample server Petstore server.
  version: 1.0.0
  title: Swagger Petstore
  termsOfService: 'http://swagger.io/terms/'
  contact:
    email: [email protected]
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
paths:
  /pet:
    post:
      tags:
        - pet
      parameters:
        - $ref: '#/components/parameters/ThisIsMissing'
components:
  parameters:
    petId:
      name: petId
      in: path
      required: true
      schema:
        type: integer
        format: int64

PR will give this data

$ref value of: #/paths/~1pet/post/parameters/0 
  is missing target: #/components/parameters/ThisIsMissing
  found: #/components/parameters

AlexHolly avatar Sep 10 '20 21:09 AlexHolly

Hi @AlexHolly. Thank you for the PR. It looks like that code should probably go inside the MissingPointerError class instead (with additional data passed as parameters to the constructor).

JamesMessinger avatar Oct 06 '20 08:10 JamesMessinger

Done.

AlexHolly avatar Oct 06 '20 15:10 AlexHolly

This PR looks good - apologies for the long delay here @AlexHolly

If you rebase this onto latest I'll merge it in.

jonluca avatar Feb 03 '23 19:02 jonluca

@jonluca I am unable to test it with https://github.com/APIDevTools/swagger-parser looks like it expects .js files. Is there a command to build them?

AlexHolly avatar Feb 06 '23 00:02 AlexHolly