Skip to content

[typescript-axios] Add Support for Operation Servers#16782

Merged
wing328 merged 4 commits intoOpenAPITools:masterfrom
Bandwidth-Sandbox:ts-axios-operation-servers
Oct 27, 2023
Merged

[typescript-axios] Add Support for Operation Servers#16782
wing328 merged 4 commits intoOpenAPITools:masterfrom
Bandwidth-Sandbox:ts-axios-operation-servers

Conversation

@ckoegel
Copy link
Contributor

@ckoegel ckoegel commented Oct 10, 2023

This PR aims to add support for operation level servers in the typescript-axios generator. A new object (operationServerMap) has been added to the base.ts file, this object contains all server objects defined at the operation level in the openapi spec file. Inside the functional programming interface for each API, each operation now checks for a server url defined in operationServerMap using the new serverIndex attribute of the Configuration class. If a url is found, that url will be used instead of the default BASE_URL. This change should be non-breaking; if there is not a server defined on the operation level, the behavior will not change. serverIndex is an optional parameter on the Configuration class and defaults to 0.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04)

@ckoegel ckoegel marked this pull request as ready for review October 10, 2023 20:52
@wing328
Copy link
Member

wing328 commented Oct 26, 2023

Thanks for the PR. Overall it looks good to me. From what I understand, this is not a breaking change.

Please correct me if I'm wrong.

@ckoegel
Copy link
Contributor Author

ckoegel commented Oct 26, 2023

Thanks for the PR. Overall it looks good to me. From what I understand, this is not a breaking change.

Please correct me if I'm wrong.

You're correct, this should be non-breaking

@wing328 wing328 merged commit eb5b781 into OpenAPITools:master Oct 27, 2023
@wing328 wing328 added this to the 7.1.0 milestone Oct 27, 2023
@ckoegel ckoegel deleted the ts-axios-operation-servers branch October 27, 2023 13:24
@modifyljf
Copy link

Is it possible to disable this feature?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants