Skip to content

fix: Parsing requestBody with $ref #633

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

Merged
merged 8 commits into from
Jun 15, 2024
Merged

Conversation

kigawas
Copy link
Contributor

@kigawas kigawas commented Jun 13, 2022

Fixes #595

Perhaps similar solution can be applied to #605

Description

The requestBody with $ref was not handled. requestBodies in components should be injected into _add_body function.

@kigawas kigawas changed the title Parsing requestBody with $ref fix: Parsing requestBody with $ref Jun 13, 2022
Copy link
Collaborator

@dbanty dbanty left a comment

Choose a reason for hiding this comment

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

Thanks so much for implementing this (checks calendar) 2 years ago 😓.

I finally got it updated, added tests, and added support for nested references. Coming soon to a release near you!

@dbanty dbanty added this pull request to the merge queue Jun 15, 2024
Merged via the queue into openapi-generators:main with commit 32f6f67 Jun 15, 2024
20 checks passed
dbanty added a commit that referenced this pull request Jun 15, 2024
This PR was created by Knope. Merging it will create a new release

### Features

#### Support request body refs

You can now define and reuse bodies via refs, with a document like this:

```yaml
paths:
  /something:
    post:
      requestBody:
        "$ref": "#/components/requestBodies/SharedBody"
components:
  requestBodies:
    SharedBody:
      content:
        application/json:
          schema:
            type: string
```

Thanks to @kigawas and @supermihi for initial implementations and
@RockyMM for the initial request.

Closes #633, closes #664, resolves #595.

### Fixes

- Indent of generated code for non-required lists. Thanks @sfowl!
(#1050)
- Parsing requestBody with $ref (#633)

Co-authored-by: GitHub <github-actions@github.com>
@kigawas kigawas deleted the patch-1 branch June 16, 2024 04:13
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.

The requestBody declared with $ref is not generating json_body
2 participants