Consider adding `Path` and `Type` properties to `OpenApiOperation`
Is your feature request related to a problem? Please describe.
If you have an operation object, there's no way to access the path or type of the operation without iterating over all paths so that you have access to this information. It seems logical for these to be properties of the operation, even if this is structured differently in the actual document text.
Describe the solution you'd like
Consider setting operation.Type and operation.Path to the applicable values.
Describe alternatives you've considered
- Storing this information separately, in a dictionary like:
Dictionary<string, (OperationType OperationType, string Path, OpenApiOperation Operation)> - Storing this information in
Extensions.
Additional context
n/a
Working on it...
Hi @glen-84 Thank you for using the SDK and for reaching out.
The goal of the object model is to provide a simple API that reflects the specification. Adding back-reference properties (or dictionary entries) would have negative performance impacts, and could also lead to "out of synchronization" bugs.
If you could share more context about what you're trying to achieve, maybe there's a better approach.
Let us know if you have any additional comments or questions.
Hi @baywet
This was over a year ago, so it's not as fresh in my mind, but we were adding the ability to access an OpenAPI service via GraphQL.
While converting REST operations to GraphQL operations, we needed to know the type of each operation in order to map it to a query or mutation.
We ended up wrapping each operation with an OpenApiOperationWrapper, that includes the operation, type, and path.
It just seemed like these were properties of the operation, so it may have made sense to provide them there, but if you want it to be a strict reflection of the source text, then that's fine and you can close this issue.
Thanks.
Thank you for the additional information. Closing