SpecterOps / BloodHound

Six Degrees of Domain Admin
https://bloodhoundenterprise.io/
Apache License 2.0
1.07k stars 106 forks source link

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

Closed daviditkin closed 1 week ago

daviditkin commented 2 weeks ago

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

Checklist:

github-actions[bot] commented 2 weeks ago

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

daviditkin commented 2 weeks ago

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