MCPcopy Create free account
hub / github.com/APIs-guru/aws2openapi / findResponsesForShape

Function findResponsesForShape

index.js:178–197  ·  view source on GitHub ↗
(openapi,shapeName)

Source from the content-addressed store, hash-verified

176}
177
178function findResponsesForShape(openapi,shapeName){
179 var result = [];
180 for (var p in openapi.paths) {
181 var path = openapi.paths[p];
182 for (var a of actions){
183 var action = path[actions[a]];
184 if (action) {
185 var ok = false;
186 for (var r in action.responses) {
187 r = parseInt(r,10);
188 if ((r>=200) && (r<700)) {
189 var ref = (r.schema ? r.schema["$ref"] : '');
190 if (ref == '#/components/schemas/'+shapeName) ok = true;
191 }
192 }
193 if (ok) result.push(r);
194 }
195 }
196 }
197}
198
199function attachHeader(openapi,shapeName,header){
200 var responses = findResponsesForShape(openapi,shapeName);

Callers 1

attachHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected