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

feat: support circular refs #1835

Merged
merged 7 commits into from
May 25, 2021
Merged

feat: support circular refs #1835

merged 7 commits into from
May 25, 2021

Conversation

pytlesk4
Copy link
Contributor

@pytlesk4 pytlesk4 commented May 25, 2021

Addresses #1456

Blocked By stoplightio/json#90

Summary

  • switch to our forked json schema ref parser
  • bundle http operations
  • validate circular data properly
  • dynamically generate data for circular structures
  • tests

Checklist

  • The basics
    • I tested these changes manually in my local or dev environment
  • Tests
    • Added or updated
    • N/A
  • Event Tracking
    • I added event tracking and followed the event tracking guidelines
    • N/A
  • Error Reporting
    • I reported errors and followed the error reporting guidelines
    • N/A

- switch to our forked json schema ref parser
- bundle http operations
- validate circular data properly
- dynamically generate data for circular structures
- tests
@pytlesk4 pytlesk4 self-assigned this May 25, 2021
@pytlesk4 pytlesk4 requested review from a team and rainum and removed request for a team May 25, 2021 03:31
Copy link
Contributor

@radzserg radzserg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's build derez in fp-ts style

packages/cli/src/operations.ts Outdated Show resolved Hide resolved
packages/cli/src/operations.ts Outdated Show resolved Hide resolved
@pytlesk4 pytlesk4 requested a review from radzserg May 25, 2021 13:56
Copy link
Contributor

@chohmann chohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the following spec:

openapi: 3.0.0
info:
  title: Test API
  version: '1.0'
servers:
  - url: 'http://localhost:3000'
paths:
  '/dog/{id}':
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
    get:
      summary: Get A Dog
      tags: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dog'
components:
  schemas:
    Dog:
      title: Dog
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        breed:
          type: string
        parent:
          $ref: '#/components/schemas/Dog'

And when the response from that endpoint:

{
   "id":0,
   "name":"string",
   "breed":"string",
   "parent":{
      "id":0,
      "name":"string",
      "breed":"string",
      "parent":{}
   }
}

So working well for me.

Just a few comments/questions.

packages/http-server/src/__tests__/server.oas.spec.ts Outdated Show resolved Hide resolved
packages/cli/src/operations.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@chohmann chohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pytlesk4 pytlesk4 merged commit d287dd7 into master May 25, 2021
@pytlesk4 pytlesk4 deleted the feat/handle-circular-refs branch May 25, 2021 20:59
This was referenced Apr 29, 2024
This was referenced Jul 2, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants