Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with deep inheritance (> 1 level) using allOf #29

Closed
gschafra opened this issue Jan 30, 2020 · 2 comments
Closed

Problem with deep inheritance (> 1 level) using allOf #29

gschafra opened this issue Jan 30, 2020 · 2 comments

Comments

@gschafra
Copy link

swagger-mock seems to have Problems with return values based on components/models which inherit from parents deeper than 1 level, e.g.:

openapi: 3.0.0
info:
  title: REST-API
components:
  schemas:
    AcquisitionRequest:
      description: Acquisition request
      allOf:
        - $ref: "#/components/schemas/Entity"
        - properties:
            threshold:
              description: >
                Invoice threshold in Euro. The threshold is defined per customer
                (doctor identified
                by the doctors identifier) as available in the PVS-Backend
              type: number
              format: float
            isGreaterEqualThreshold:
              description: >
                Indicates if value is greater equal the threshold (>=).
              type: boolean
            value:
              description: >
                Value in Euro the acquisition is requested for. 
              type: number
              format: float
            status:
              description: Processing status
              type: string
              enum:
                - collected
                - authorized
                - open
                - accepted
                - rejected
                - postalwrong
              default: open
          required:
            - status
    AcquisitionRequest_Read:
      description: >
        Read (GET) representation of acquisition request, taking the mandatory
        isGreaterEqualThreshold attribute into account
      allOf:
        - $ref: "#/components/schemas/AcquisitionRequest"
      required:
        - isGreaterEqualThreshold
paths:
  /acquisition_requests:
    get:
      summary: List of acquisition requests
      responses:
        "200":
          description: List of acquisition requests
          content:
            application/json:
              schema:
                type: array
                uniqueItems: true
                items:
                  $ref: "#/components/schemas/AcquisitionRequest_Read"
        "204":
          description: Paging limit reached
        "401":
          description: Unauthorized

Requesting the /acquisition_request with GET always/just returns:

[
    {}
]
@strider2038
Copy link
Collaborator

Sadly, this problem cannot be fixed quickly. We are working on the next version of the library. So I think the problem with deep inheritance should be considered as a limitation of v0.1.

@strider2038
Copy link
Collaborator

strider2038 commented May 27, 2020

This problem was solved in version v0.2. Be aware, the project was moved to another location. Please, read project description for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants