@Test public void shouldParseSpecificationWithSecurityRequirements() { final OpenApiModelInfo info = OpenApiConnectorGenerator.parseSpecification(new ConnectorSettings.Builder() .putConfiguredProperty("specification", "{\"swagger\":\"2.0\",\"paths\":{\"/api\":{\"get\":{\"security\":[{\"secured\":[]}]}}}}") .build(), APIValidationContext.CONSUMED_API); final Oas20Document model = info.getV2Model(); assertThat(model.paths.getPathItem("/api").get.security).hasSize(1); assertThat(model.paths.getPathItem("/api").get.security.get(0).getSecurityRequirementNames()).containsExactly("secured"); assertThat(model.paths.getPathItem("/api").get.security.get(0).getScopes("secured")).isEmpty(); final String resolvedSpecification = info.getResolvedSpecification(); assertThatJson(resolvedSpecification).isEqualTo("{\"swagger\":\"2.0\",\"paths\":{\"/api\":{\"get\":{\"security\":[{\"secured\":[]}]}}}}"); final ObjectNode resolvedJsonGraph = info.getResolvedJsonGraph(); final JsonNode securityRequirement = resolvedJsonGraph.get("paths").get("/api").get("get").get("security"); assertThat(securityRequirement).hasSize(1); assertThat(securityRequirement.get(0).get("secured")).isEmpty(); }
static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification, validationContext); }
OpenApiConnectorGenerator extends ConnectorGenerator { static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification, validationContext); } }
OpenApiConnectorGenerator extends ConnectorGenerator { static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification, validationContext); } OpenApiConnectorGenerator(final Connector baseConnector, final Supplier<String> operationIdGenerator);  OpenApiConnectorGenerator(final Connector baseConnector); }
OpenApiConnectorGenerator extends ConnectorGenerator { static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification, validationContext); } OpenApiConnectorGenerator(final Connector baseConnector, final Supplier<String> operationIdGenerator);  OpenApiConnectorGenerator(final Connector baseConnector); @Override final Connector generate(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings); @Override final APISummary info(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings); }
OpenApiConnectorGenerator extends ConnectorGenerator { static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification, validationContext); } OpenApiConnectorGenerator(final Connector baseConnector, final Supplier<String> operationIdGenerator);  OpenApiConnectorGenerator(final Connector baseConnector); @Override final Connector generate(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings); @Override final APISummary info(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings); static final String SPECIFICATION; }