Skip to main content

GetOpenapiSpec

Returns the OpenAPI specification of specified API gateway.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const GetOpenapiSpecRequest =
cloudApi.serverless.apigateway_apigateway_service.GetOpenapiSpecRequest;
const GetOpenapiSpecRequest_Format =
cloudApi.serverless.apigateway_apigateway_service
.GetOpenapiSpecRequest_Format;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ApiGatewayServiceClient);

const result = await client.getOpenapiSpec(
GetOpenapiSpecRequest.fromPartial({
apiGatewayId: "apiGatewayId",
// format: GetOpenapiSpecRequest_Format.JSON
})
);
console.log(result);
})();

GetOpenapiSpecRequest

Format

  • FORMAT_UNSPECIFIED

  • JSON

  • YAML

apiGatewayId : string

ID of the API gateway to get specification from.

format : Format

Format of returned specification. Default is the original format used in CreateApiGatewayRequest.

GetOpenapiSpecResponse

apiGatewayId : string

ID of the API gateway.

openapiSpec : string

The text of specification, JSON or YAML.