-
Notifications
You must be signed in to change notification settings - Fork 17
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
Proposal: Improved system for filtering operations out of the generated library #179
Comments
Hello again, @maxb and thank you for the detailed proposal! The exclusion of *2 and *3 suffixes was indeed a hacky fix introduced in #154. To add to the list of the endpoints you mentioned above, we also now have ACME endpoints under PKI, which are not supposed to be generated in the libraries. Internally, we have been discussing adding yet another vendor field in the openapi spec at the operation level, e.g. I like your proposal as well! Once the OpenAPI spec is a bit more polished, we are planning to publish it in a separate repo with its own CI pipelines and two separate specs (a raw one and one specific to the generated We'll have a further discussion in the team to determine which approach is best. Meanwhile, we'd be happy to hear your thoughts as well! |
I have two concerns with this approach:
|
I think that's a desired outcome. We are moving towards a single source-of-truth OpenAPI document, whether it is generated by a python script or has flags to prevent generation.
What you described applies well to a deprecation workflow. OpenAPI already supports The suggested
I think it still could make sense to keep deprecated methods in a new library until they have been fully removed from the OpenAPI spec to keep the libraries consistent between each other.
Yes, this has been an issue we've been dealing with for populating the response structures and operation ID's. It does add more operational overhead but I think it may be justified in the end. The exclusion flag is not likely to change once set. We could also have logic in |
I propose that this project is in need of a nicer way to exclude specific operations from the generated library.
Currently, operationIds ending with 2 or 3 are filtered, but accomplishing this has required implementing the filter list in multiple ways, in many places:
vault-client-go/generate/templates/api.handlebars
Lines 20 to 23 in c9387ae
vault-client-go/generate/templates/api_doc.handlebars
Line 7 in c9387ae
vault-client-go/generate/templates/api_doc.handlebars
Line 11 in c9387ae
vault-client-go/.openapi-generator-ignore
Lines 7 to 15 in c9387ae
It is already very unappealing to extend this list further, and yet, there are more endpoints I think are in the interests of the library's users, to exclude, such as:
sys/monitor
- since this endpoint returns a streaming response, it cannot be realistically handled other than by custom hand written codeidentity/alias
identity/alias/id
identity/alias/id/{id}
identity/persona
identity/persona/id
identity/persona/id/{id}
Other cases may arise.
Ideally we would just add these to a simple exclude list in a format that could be easily shared with vault-client-dotnet or future languages.
The upstream openapi-generator project does not have an answer for us. It only supports include lists for things to generate, not exclude lists, and then only as a single string, not reading from a file.
I propose, therefore, that we need to create a small filter script, that reads the raw OpenAPI spec fetched from Vault, selectively deletes operations by matching against an operationId exclude list, and feeds the filtered OpenAPI spec to openapi-generator.
Such a filter script could be very easily implemented in Python, using exclusively its built in standard library. Also, Python is a common language interpreter available in many developer environments. Therefore, Python feels like the right tool for the job for this filter script. Go is not an appealing tool for the job, as its builtin JSON library isn't well suited to dynamic processing, and insists on randomizing the order of object keys.
Please advise what you think of this, and whether it's worth progressing to a PR.
The text was updated successfully, but these errors were encountered: