@Test public void throwsWhenServiceNotConfigured() { Model model = Model.assembler() .addImport(OpenApiConverterTest.class.getResource("test-service.json")) .discoverModels() .assemble() .unwrap(); MockManifest manifest = new MockManifest(); PluginContext context = PluginContext.builder() .settings(Node.objectNode()) .fileManifest(manifest) .model(model) .originalModel(model) .build(); assertThrows(OpenApiException.class, () -> { new Smithy2OpenApi().execute(context); }); }
@Override public void execute(PluginContext context) { OpenApiConverter converter = OpenApiConverter.create(); context.getPluginClassLoader().ifPresent(converter::classLoader); OpenApiConfig config = OpenApiConfig.fromNode(context.getSettings()); ShapeId shapeId = config.getService(); converter.config(config); ObjectNode openApiNode = converter.convertToNode(context.getModel()); context.getFileManifest().writeJson(shapeId.getName() + ".openapi.json", openApiNode); }
Smithy2OpenApi implements SmithyBuildPlugin { @Override public void execute(PluginContext context) { OpenApiConverter converter = OpenApiConverter.create(); context.getPluginClassLoader().ifPresent(converter::classLoader); OpenApiConfig config = OpenApiConfig.fromNode(context.getSettings()); ShapeId shapeId = config.getService(); converter.config(config); ObjectNode openApiNode = converter.convertToNode(context.getModel()); context.getFileManifest().writeJson(shapeId.getName() + ".openapi.json", openApiNode); } }
Smithy2OpenApi implements SmithyBuildPlugin { @Override public void execute(PluginContext context) { OpenApiConverter converter = OpenApiConverter.create(); context.getPluginClassLoader().ifPresent(converter::classLoader); OpenApiConfig config = OpenApiConfig.fromNode(context.getSettings()); ShapeId shapeId = config.getService(); converter.config(config); ObjectNode openApiNode = converter.convertToNode(context.getModel()); context.getFileManifest().writeJson(shapeId.getName() + ".openapi.json", openApiNode); }  }
Smithy2OpenApi implements SmithyBuildPlugin { @Override public void execute(PluginContext context) { OpenApiConverter converter = OpenApiConverter.create(); context.getPluginClassLoader().ifPresent(converter::classLoader); OpenApiConfig config = OpenApiConfig.fromNode(context.getSettings()); ShapeId shapeId = config.getService(); converter.config(config); ObjectNode openApiNode = converter.convertToNode(context.getModel()); context.getFileManifest().writeJson(shapeId.getName() + ".openapi.json", openApiNode); }  @Override String getName(); @Override void execute(PluginContext context); }
Smithy2OpenApi implements SmithyBuildPlugin { @Override public void execute(PluginContext context) { OpenApiConverter converter = OpenApiConverter.create(); context.getPluginClassLoader().ifPresent(converter::classLoader); OpenApiConfig config = OpenApiConfig.fromNode(context.getSettings()); ShapeId shapeId = config.getService(); converter.config(config); ObjectNode openApiNode = converter.convertToNode(context.getModel()); context.getFileManifest().writeJson(shapeId.getName() + ".openapi.json", openApiNode); }  @Override String getName(); @Override void execute(PluginContext context);  }