datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Json pointer encoding

Open igorbanfi opened this issue 2 years ago • 0 comments

Describe the bug

When referencing paths from another file with json pointer encoding according to RFC-6901 or url encoding, Models not found in the input data is outputted.

To Reproduce

openapi.yaml:


openapi: 3.0.1
info:
  title: "pass"
  version: ""

paths:
  # events
  /test/subscribe:
    $ref: "evts.yaml#/paths/~1test~1test"

evts.yaml:

openapi: 3.0.1
info:
  title: evts
  description: evts
  version: "0.0.0"

tags:
- name: evts
  description: |
    evts

paths:
  /test/test:
    post:
      operationId: evts
      description: |
        evts
      tags:
      - Events
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        default:
          description: ""
      callbacks:
        test:
          '{$url}':
            post:
              requestBody:
                description: ""
                required: true
                content:
                  application/json:
                    schema:
                      "$ref": "#/components/schemas/Sample"
              responses:
                default:
                  description: ""

components:
  schemas:
    Sample:
      description: Sample
      type: object
      properties:
        sample:
          type: string

Used commandline:

$ datamodel-codegen --input openapi.yaml  --input-file-type openapi --openapi-scopes paths

Expected behavior Generation of models.

Version:

  • OS: Ubuntu 22.04
  • Python version: 3.10
  • datamodel-code-generator version: 0.22.0

igorbanfi avatar Oct 02 '23 13:10 igorbanfi