Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Allow SE users work with OpenApiFeature instead of SeOpenApiFeature #7103

Merged
merged 4 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/quickstarts/helidon-quickstart-se/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
<artifactId>helidon-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.nima.openapi</groupId>
<artifactId>helidon-nima-openapi</artifactId>
<groupId>io.helidon.openapi</groupId>
<artifactId>helidon-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import io.helidon.logging.common.LogConfig;
import io.helidon.nima.observe.ObserveFeature;
import io.helidon.nima.openapi.SeOpenApiFeature;
import io.helidon.nima.webserver.WebServer;
import io.helidon.nima.webserver.http.HttpRouting;
import io.helidon.openapi.OpenApiFeature;

/**
* The application main class.
Expand Down Expand Up @@ -54,7 +54,7 @@ public static void main(String[] args) {
* Updates HTTP Routing and registers observe providers.
*/
static void routing(HttpRouting.Builder routing) {
SeOpenApiFeature openApi = SeOpenApiFeature.builder().build();
OpenApiFeature openApi = OpenApiFeature.builder().build();
GreetService greetService = new GreetService();
routing.addFeature(openApi)
.register("/greet", greetService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class MpOpenApiFeature extends OpenApiFeature {
*
* @return new builder
*/
static MPOpenAPIBuilder builder() {
public static MPOpenAPIBuilder builder() {
return new MPOpenAPIBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
* Copyright (c) 2019, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.nima.openapi.test;
package io.helidon.microprofile.openapi.test;

import org.eclipse.microprofile.openapi.OASFactory;
import org.eclipse.microprofile.openapi.OASModelReader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
* Copyright (c) 2019, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.nima.openapi.test;
package io.helidon.microprofile.openapi.test;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion microprofile/openapi/src/test/resources/serverConfig.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 Oracle and/or its affiliates.
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
openapi.model.reader: io.helidon.nima.openapi.test.MyModelReader
openapi.filter: io.helidon.nima.openapi.test.MySimpleFilter
openapi.model.reader: io.helidon.microprofile.openapi.test.MyModelReader
openapi.filter: io.helidon.openapi.microprofile.MySimpleFilter
openapi.servers: s1,s2
openapi.servers.path.path1: p1s1,p1s2
openapi.servers.path.path2: p2s1,p2s2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
# Copyright (c) 2019, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
openapi.model.reader: io.helidon.nima.openapi.test.MyModelReader
openapi.filter: io.helidon.nima.openapi.test.MySimpleFilter
openapi.model.reader: io.helidon.microprofile.openapi.test.MyModelReader
openapi.filter: io.helidon.microprofile.openapi.test.MySimpleFilter
openapi.servers: s1,s2
openapi.servers.path.path1: p1s1,p1s2
openapi.servers.path.path2: p2s1,p2s2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion nima/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<module>fault-tolerance</module>
<module>testing</module>
<module>service-common</module>
<module>openapi</module>
<module>graphql</module>
</modules>

Expand Down
9 changes: 9 additions & 0 deletions openapi/src/main/java/io/helidon/openapi/OpenApiFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ public abstract class OpenApiFeature extends HelidonFeatureSupport {
*/
public static final String DEFAULT_CONTEXT = "/openapi";

/**
* Returns a new builder for preparing an SE variant of {@code OpenApiFeature}.
*
* @return new builder
*/
public static Builder<?, ?> builder() {
tjquinno marked this conversation as resolved.
Show resolved Hide resolved
return new SeOpenApiFeature.Builder();
}

/**
* URL query parameter for specifying the requested format when retrieving the OpenAPI document.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.nima.openapi;

import io.helidon.openapi.OpenApiFeature;
package io.helidon.openapi;

/**
* SE implementation of {@link OpenApiFeature}.
*/
public class SeOpenApiFeature extends OpenApiFeature {
class SeOpenApiFeature extends OpenApiFeature {

private static final System.Logger LOGGER = System.getLogger(SeOpenApiFeature.class.getName());

/**
* Create a new builder for the feature.
*
* @return the new builder
*/
public static Builder builder() {
return new Builder();
}

/**
* Creates a new instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@
*/
package io.helidon.openapi;

import java.io.StringReader;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import jakarta.json.Json;
import jakarta.json.JsonBuilderFactory;
import jakarta.json.JsonObject;
import jakarta.json.stream.JsonParser;
import org.yaml.snakeyaml.Yaml;

public class StaticFileOnlyOpenApiFeatureImpl extends OpenApiFeature {
class StaticFileOnlyOpenApiFeatureImpl extends OpenApiFeature {

private static final System.Logger LOGGER = System.getLogger(StaticFileOnlyOpenApiFeatureImpl.class.getName());

private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Map.of());

static Builder builder() {
public static Builder builder() {
return new Builder();
}

Expand Down