Skip to content

Support request bodies components #664

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

Conversation

supermihi
Copy link
Contributor

@supermihi supermihi commented Aug 26, 2022

adds support for request bodies referencing to components/requestBodies/<name> (see spec)

Fixes #595. Sorry I only found #633 after preparing this PR, but in contrast to #633 this one also updates tests (including e2e).

@supermihi
Copy link
Contributor Author

Note – I probably won't have time to continue this for the next few weeks, would be happy if s/o else could pick up :)

@supermihi supermihi force-pushed the support-request-bodies-components branch from 22fceac to c730b9f Compare September 5, 2022 14:33
@supermihi supermihi force-pushed the support-request-bodies-components branch from c730b9f to 87969ab Compare October 21, 2022 14:06
@supermihi
Copy link
Contributor Author

@dbanty I think it's complete now, would you mind to take a look?

Disclaimer: I fixed the existing unit tests but did not write new ones especially for the new fetaure. To be honest I didn't really understand what how the tests work and what they actually test. ;-)

@supermihi supermihi changed the title DRAFT: Support request bodies components Support request bodies components Nov 2, 2022
@dbanty
Copy link
Collaborator

dbanty commented Jun 15, 2024

Thank you for doing this, and sorry it took so long for me to get around to it. I ended up updating the other PR and finishing off, since there are soo many merge conflicts now (due to my delay).

@dbanty dbanty closed this Jun 15, 2024
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>
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