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

PAYARA-2548 OpenAPI 1.0 Implementation #2745

Merged
merged 23 commits into from May 30, 2018
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c9063a0
Initial OpenAPI implementation.
MattGill98 May 11, 2018
1e00717
Base Processor model.
MattGill98 May 11, 2018
1cc9dfb
Added base REST service.
MattGill98 May 11, 2018
0b3f2c8
Added tests for processors.
MattGill98 May 11, 2018
cfc01d9
Added application scanner and visitor model.
MattGill98 May 11, 2018
bc50a7c
Added annotation processing.
MattGill98 May 11, 2018
f59cc72
Added static file parsing.
MattGill98 May 11, 2018
29c430f
Added filter and model reader processors.
MattGill98 May 11, 2018
6169f3f
Patched config API to work for null invocation contexts.
MattGill98 May 11, 2018
499f13d
Fixed TCK tests, and added copyright headers.
MattGill98 May 18, 2018
99370d7
Patched config API and OpenAPI to search root META-INF as well.
MattGill98 May 21, 2018
52f26b1
Moved OpenAPI logging into service, and disabled OpenAPI for non WARs.
MattGill98 May 22, 2018
03c67b7
Merge branch 'master' of github.com:payara/Payara into PAYARA-2548-Im…
MattGill98 May 22, 2018
a227301
Fixed embedded classloader issue.
MattGill98 May 23, 2018
770db5c
Removed harmless ClassNotFound errors to allow for arquillian tests.
MattGill98 May 23, 2018
ea1e84f
Fixed NPE if no classes are present.
MattGill98 May 23, 2018
3ca3a18
Fixed a bunch of sonarqube issues.
MattGill98 May 24, 2018
f6114ca
Merge branch 'master' of github.com:payara/Payara into PAYARA-2548-Im…
MattGill98 May 24, 2018
012572e
Removed weld proxy classes as well as java base classes from model.
MattGill98 May 29, 2018
4372ed9
Also ignored Java EE response types.
MattGill98 May 29, 2018
33e3624
Load the classes directly from the archive.
MattGill98 May 29, 2018
b949344
Added support for schema inheritance.
MattGill98 May 29, 2018
c6ee4ca
Merge branch 'master' into PAYARA-2548-Implement-OpenAPI-1.0-REBASE
Pandrex247 May 30, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions appserver/packager/microprofile-package/pom.xml
Expand Up @@ -165,6 +165,18 @@
<artifactId>microprofile-metrics</artifactId>
<version>${project.version}</version>
</dependency>

<!-- OpenAPI -->
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>${microprofile-openapi.version}</version>
</dependency>
<dependency>
<groupId>fish.payara.microprofile.openapi</groupId>
<artifactId>microprofile-openapi</artifactId>
<version>${project.version}</version>
</dependency>

<!-- JWT -->
<dependency>
Expand Down
101 changes: 101 additions & 0 deletions appserver/payara-appserver-modules/microprofile/openapi/pom.xml
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) [2018] Payara Foundation and/or its affiliates. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://github.com/payara/Payara/blob/master/LICENSE.txt
See the License for the specific
language governing permissions and limitations under the License.

When distributing the software, include this License Header Notice in each
file and include the License file at glassfish/legal/LICENSE.txt.

GPL Classpath Exception:
The Payara Foundation designates this particular file as subject to the "Classpath"
exception as provided by the Payara Foundation in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>fish.payara.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>5.182-SNAPSHOT</version>
</parent>

<groupId>fish.payara.microprofile.openapi</groupId>
<artifactId>microprofile-openapi</artifactId>
<packaging>glassfish-jar</packaging>

<name>Microprofile - OpenAPI</name>
<description>Implementation of MicroProfile OpenAPI</description>

<dependencies>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<version>${microprofile-config.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>${microprofile-openapi.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.web</groupId>
<artifactId>web-glue</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>internal-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,61 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) [2018] Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://github.com/payara/Payara/blob/master/LICENSE.txt
* See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* The Payara Foundation designates this particular file as subject to the "Classpath"
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package fish.payara.microprofile.openapi.api.processor;

import org.eclipse.microprofile.openapi.models.OpenAPI;

import fish.payara.microprofile.openapi.impl.config.OpenApiConfiguration;

/**
* A processor accepts an {@link OpenAPI} object, and returns a new model after
* applying a transformation.
*/
public interface OASProcessor {

/**
* Processes a model.
*
* @param api the OpenAPI model to process.
* @param config the configuration to use.
* @return a processed model.
*/
OpenAPI process(OpenAPI api, OpenApiConfiguration config);

}
@@ -0,0 +1,67 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) [2018] Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://github.com/payara/Payara/blob/master/LICENSE.txt
* See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* The Payara Foundation designates this particular file as subject to the "Classpath"
* exception as provided by the Payara Foundation in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package fish.payara.microprofile.openapi.api.visitor;

import org.eclipse.microprofile.openapi.models.OpenAPI;
import org.eclipse.microprofile.openapi.models.Operation;

/**
* The context in which a class object is being visited. For example, if a
* method is being visited, the context will contain the current state of the
* {@link OpenAPI}, and the current path in the API.
*/
public interface ApiContext {

/**
* The current {@link OpenAPI} object being operated on.
*/
OpenAPI getApi();

/**
* The path of the object currently being visited. If the path is null, the
* object has no context (e.g a POJO).
*/
String getPath();

/**
* The created operation currently being worked on.
*/
Operation getWorkingOperation();
}