once I create a proxy using the add proxy wizard and as part of a new revision, I want to add the swagger def to the proxy without having to create a new proxy. I can't find any option in the edge UI to complete this task.
also how do you replace a swagger def within a proxy without creating a new proxy?
Yes, you can. Assuming you got the OpenAPI spec, there are two options;
1) Using an AssignMessage Policy. e.g.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RaiseFault async="false" continueOnError="false" enabled="true" name="return-open-api"> <DisplayName>Return Open API</DisplayName> <Properties/> <FaultResponse> <Set> <StatusCode>200</StatusCode> <Headers> <Header name="Content-Type">application/json</Header> </Headers> <Payload contentType="application/json" variablePrefix="@" variableSuffix="#">{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "AmazonS3", "description": "A OAS document generated from WSDL", "termsOfService": "", "contact": { "name": "API Team" }, "license": { "name": "Apache 2.0" } } ... }</Payload> </Set> </FaultResponse> </RaiseFault>
Along with a conditional flow to run this policy:
<Flow name="GetOAS"> <Description>Get Open API Specification</Description> <Request> <Step> <Name>return-open-api</Name> </Step> </Request> <Response/> <Condition>(proxy.pathsuffix MatchesPath "/openapi.json") and (request.verb = "GET")</Condition> </Flow>
2) Using Node.js by serving static files mounting a static folder. e.g.
var express = require('express'), app = express(); path = require('path'); app.use(express.static(path.join(__dirname, 'openapi_spec'))); app.listen(9000);
then any file under resources/node/openapi_spec/ folder will be served. See this tutorial. https://github.com/dzuluaga/apigee-tutorials/tree/master/apiproxies/apigee-nodejs-fileserver
Many way to skin this cat 🙂
Let us know how it goes.
not what I am looking for. I want to be able to run the import wizard and choose a subset of one or more methods from the swagger doc. Not load all available methods into the proxy.
@DCarlson, You can choose a subset of one or more methods from the swagger doc as part of creating a new proxy as you know but you can't do that once you have a proxy created.
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
1 |