I want to deploy a ServiceStack API to Google Cloud Run, utilizing Google Cloud Endpoints. I have 2 questions about the specification document:
According to the tutorial, I need to add x-google-backend to the document. How should I configure OpenApiFeature to add this with its 2 children?
By default, the Open API document in ServiceStack is at /openapi. GCP seems to only allow uploading the document in json or yaml format, not by URL. Is it possible to generate this document during the build process somehow?
2b. The generated document’s host must also not be localhost and I need to be able to configure it to be the real host.
The OpenApiDeclaration is a typed DTO that represents the top-level Open API declaration object, there’s no way to extend it with additional properties.
It’s a runtime ServiceStack Service so it needs an initialized & started AppHost.
IMO the best approach is to create a self-host AppHost Console App as done in the Integration Testing example that calls the /openapi endpoint after it’s started, saves the result then shuts down the app. When saving the generated json you can also copy/replace the json output to inject the x-google-backend property.
In your custom Console App replace the BaseUrl with by setting Config.WebHostUrl, e.g: