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

rtk-query-codegen-openapi auth (custom headers for swagger url) #3468

Closed
Mozzarella123 opened this issue May 23, 2023 · 1 comment · Fixed by #4522
Closed

rtk-query-codegen-openapi auth (custom headers for swagger url) #3468

Mozzarella123 opened this issue May 23, 2023 · 1 comment · Fixed by #4522

Comments

@Mozzarella123
Copy link

Problem

I can't parse swagger schema with authorization required url

Solution

Would be great if i can pass headers or control auth in config file

const sourceCode = await enforceOazapftsTsVersion(() => {
const { generateApi } = require('./generate');
return generateApi(schemaAbsPath, options);
});

const v3Doc = await getV3Doc(spec);

const doc = await SwaggerParser.bundle(spec);

https://github.com/APIDevTools/swagger-parser/blob/main/docs/swagger-parser.md#bundleapi-options-callback

bundle(api, [options], [callback])
api (required) - string or object
A Swagger Object, or the file path or URL of your Swagger API. See the parse method for more info.

options (optional) - object
See options for the full list of options

https://github.com/APIDevTools/swagger-parser/blob/main/docs/options.md#resolve-options

http.headers - You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the Accept or Referrer header.

@markerikson
Copy link
Collaborator

Should be live in https://github.com/reduxjs/redux-toolkit/releases/tag/%40rtk-query%2Fcodegen-openapi%402.0.0-alpha.0 ! Please try it out and let us know if it works.

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

Successfully merging a pull request may close this issue.

2 participants