Issue while converting to OpenAPI
We need to use GCP OpenAPI specification for one of our use case, but we found that OpenAPI specs aren't available. So we are using Google API discovery format (https://www.googleapis.com/discovery/v1/apis) and converting it to OpenAPI spec.
Parser to parse discovery format: github.com/googleapis/gnostic/conversions Converter to convert discovery to Open API format: github.com/googleapis/gnostic/discovery
Conversion is successful but the generated open api specs has certain issues i will mention one below.
Below is one of the operation.
If you look at the endpoint it has one path param as parent, and if you look in the param description, parent path param can be expanded to projects/*/locations/*/keyRings/*. If you are writing some automation around this to call this apis, this becomes the problem because we cannot be sure how the parent path param can be expanded & to know this we need to read the description which might not be good idea.
So wanted to know if there is any way we can get the complete path along with all the param definition in the open api spec.
/v1/parent/cryptoKeys:
get:
description: Lists CryptoKeys.
operationId: cloudkms.projects.locations.keyRings.cryptoKeys.list
parameters:
- name: filter
in: query
description: Optional. Only include resources that match the filter in the response. For more information, see [Sorting and filtering list results](https://cloud.google.com/kms/docs/sorting-and-filtering).
schema:
type: string
- name: orderBy
in: query
description: Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see [Sorting and filtering list results](https://cloud.google.com/kms/docs/sorting-and-filtering).
schema:
type: string
- name: pageSize
in: query
description: Optional. Optional limit on the number of CryptoKeys to include in the response. Further CryptoKeys can subsequently be obtained by including the ListCryptoKeysResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
schema:
type: integer
format: int32
- name: pageToken
in: query
description: Optional. Optional pagination token, returned earlier via ListCryptoKeysResponse.next_page_token.
schema:
type: string
- name: parent
in: path
description: Required. The resource name of the KeyRing to list, in the format `projects/*/locations/*/keyRings/*`.
required: true
schema:
type: string
Thanks - just adding some additional detail, I believe the corresponding method in the discovery document has this value for its flatPath:
v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}
Also for comparison, the OpenAPI spec for this method produced by a different converter has the same problem.
Looking further, I see that the API protos refer to this argument as parent and not its constituent parts (also here). This means that the only source of information that I've found (so far) about the structure of the parent argument is the text in the comments. We might still find a way to use that, but it would explain why this is missing from the converted OpenAPI descriptions.
Checking the Google API Explorer for this method, I found that it also refers to this argument as parent and not by its constituent parts.