Skip to content

feat: allow headers from openapi#41

Merged
monotykamary merged 1 commit into
masterfrom
feat/allow-headers-openapi
Mar 29, 2024
Merged

feat: allow headers from openapi#41
monotykamary merged 1 commit into
masterfrom
feat/allow-headers-openapi

Conversation

@monotykamary

@monotykamary monotykamary commented Oct 24, 2023

Copy link
Copy Markdown
Contributor

What's this PR do?

OpenAPI comes with a key that allows us to identify whether a variable is from the query parameter, body, or header parameter. One particular case that happens a lot is CORS, and if we allow for more secured CORS request, we will eventually have to transform the headers within the request or do some jumps to get it working. This PR enables headers to be generated with other parameters, to allow easy input of header parameters. This is most likely a breaking change, as it alters the arity of the functions generated from Orval.

  • Update orval to allow passing headers from OpenAPI
image image

An example parameter that uses "in": "header" to allow orval to generate header params:

{
   ...
   "parameters":[
      {
         "required":false,
         "schema":{
            "title":"Authorization",
            "type":"string"
         },
         "name":"authorization",
         "in":"query"
      },
      {
         "required":false,
         "schema":{
            "title":"Origin",
            "type":"string"
         },
         "name":"origin",
         "in":"header"
      },
      {
         "required":false,
         "schema":{
            "title":"Access-Control-Request-Headers",
            "type":"string"
         },
         "name":"access-control-request-headers",
         "in":"header"
      }
   ]
   ...
}

@netlify

netlify Bot commented Oct 24, 2023

Copy link
Copy Markdown

Deploy Preview for df-nextjs-boilerplate ready!

Name Link
🔨 Latest commit 0ad2780
🔍 Latest deploy log https://app.netlify.com/sites/df-nextjs-boilerplate/deploys/6537568f90e1c100084316db
😎 Deploy Preview https://deploy-preview-41--df-nextjs-boilerplate.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify

netlify Bot commented Oct 24, 2023

Copy link
Copy Markdown

Deploy Preview for df-nextjs-boilerplate-storybook ready!

Name Link
🔨 Latest commit 0ad2780
🔍 Latest deploy log https://app.netlify.com/sites/df-nextjs-boilerplate-storybook/deploys/6537568ff1759c0008bef856
😎 Deploy Preview https://deploy-preview-41--df-nextjs-boilerplate-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@monotykamary monotykamary changed the title feat: allow headers for openapi feat: allow headers from openapi Oct 24, 2023
@monotykamary monotykamary merged commit 6667a76 into master Mar 29, 2024
@zlatanpham zlatanpham deleted the feat/allow-headers-openapi branch April 21, 2025 00:07
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.

1 participant