Swagger definition for multiple backends

sidd-harth
Participant V

Hi guys, I am looking to build a set of developer portals for a Telecom use case, which has multiple brands. I am not sure what brands are right now, I am assuming each branch has its own backend and each brand will be having its own Developer Portal.

I have a swagger specification with two resources GET & POST. Each resource requires few input parameters in query/path/header variables.

Now the same two resources can/will be used to connect with multiple brands/backends. Each brand/backend expects a different set of input parameters.

Example - 
Brand1 - Backend1 requires 2 query parameters and 1 header variables.
Brand2 - Backend2 requires 1 path parameters and 4 query variables.

So should I have two Swagger specifications for 2 Brands,

or

Can we use one swagger specification add some logic, where depending on the brand/backend the number of input parameters fields changes automatically in Swagger definition?

@Anil Sagar @Dino

Solved Solved
0 3 806
1 ACCEPTED SOLUTION

@Siddharth Barahalikar ,

BTB, No more swagger, It's all about OpenAPI Spec.

As far as i know, You need to use two different OpenAPI Specs. OpenAPI is a spec, it doesn't have any logic to differentiate based on some condition.

As long as those APIs has different paths & verbs, You can use same spec. If Path & Verb are same but different responses, You need to use different specs in Open API 2.0.

Open API 3.0 supports different responses based on req/res media type. But, Apigee don't support 3.0 at this point of time.

Even if you have different spec, In smartdocs you can render same under a single category using revisions options.

Hope it helps.

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

View solution in original post

3 REPLIES 3

@Siddharth Barahalikar ,

BTB, No more swagger, It's all about OpenAPI Spec.

As far as i know, You need to use two different OpenAPI Specs. OpenAPI is a spec, it doesn't have any logic to differentiate based on some condition.

As long as those APIs has different paths & verbs, You can use same spec. If Path & Verb are same but different responses, You need to use different specs in Open API 2.0.

Open API 3.0 supports different responses based on req/res media type. But, Apigee don't support 3.0 at this point of time.

Even if you have different spec, In smartdocs you can render same under a single category using revisions options.

Hope it helps.

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

Thanks, @Anil Sagar

In our requirement, the Path & Verb are different. Each resource can connect to multiple backends by accepting different requests & producing different responses.

Never explored OpenAPI 3.0, I will look into it.

--

Please clarify this generic question - If an API accepts two different inputs & produce two different outputs, does it count as 2 APIs or 1 API?

Note - I have worked on APIs for a long time, but right now I am confused 😄

6739-im-confused-m08wjd.jpg

@Siddharth Barahalikar ,

Give me a detailed example with method, path, req, response. I will clarify everything. It should be simple. We are making it too complex.