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

BED-4808: Feature/847 openapi codegen limitations #861

Merged

Conversation

daviditkin
Copy link
Contributor

Description

Modified openapi specification to address limitations in the oapi-codegen sdk code generator.
Specifically:

  1. Several 200 response define the response schema 'in-place'. In certain circumstances this confuses the code generator. The problematic response definitions were moved into their own response schema file and referenced using a $ref.
  2. There are openapi parameters that have deprecated properties that cause oapi-codegen to generate duplicate field definitions. This was fixed by adding explicit 'x-go-name' extensions to disambiguate the deprecated names.
  3. There was a readOnly definition for a $ref that was incorrect.

Motivation and Context

This PR addresses: 672

The openapi spec was causing oapi-codegen to generate incorrect / uncompilable go client sdk code. These workarounds allow the codegenerator to generate correct go code and the modifications to the spec still describe the same response or request json.

How Has This Been Tested?

The modified apis were tested with a oapi-codegen generated client.

Types of changes

  • New feature openapi specification modifications

Checklist:

  • I have met the contributing prerequisites
  • I have ensured that related documentation is up-to-date
    • Open API docs
    • Code comments (GoDocs / JSDocs)
  • I have followed proper test practices
    • Added/updated tests to cover my changes
    • All new and existing tests passed

@daviditkin daviditkin requested a review from a team as a code owner September 16, 2024 17:52
Copy link

github-actions bot commented Sep 16, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@daviditkin
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@sircodemane sircodemane left a comment

Choose a reason for hiding this comment

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

looks good to me!

@irshadaj irshadaj merged commit 4d81712 into SpecterOps:main Sep 23, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 2024
@irshadaj irshadaj changed the title Feature/847 openapi codegen limitations BED-4808: Feature/847 openapi codegen limitations Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants