├── tck
├── src
│ └── main
│ │ ├── resources
│ │ ├── META-INF
│ │ │ ├── tck
│ │ │ └── NOTICE
│ │ ├── scan-disable-microprofile-config.properties
│ │ ├── microprofile-reader.properties
│ │ ├── microprofile-config-filter.properties
│ │ ├── class-microprofile-config.properties
│ │ ├── microprofile-reader-just-webhook.properties
│ │ ├── microprofile-reader-just-component.properties
│ │ ├── schema-microprofile-config.properties
│ │ ├── server-microprofile-config.properties
│ │ └── customDialect.yaml
│ │ └── java
│ │ └── org
│ │ └── eclipse
│ │ └── microprofile
│ │ └── openapi
│ │ ├── filter
│ │ └── package-info.java
│ │ ├── apps
│ │ ├── airlines
│ │ │ ├── package-info.java
│ │ │ ├── data
│ │ │ │ └── package-info.java
│ │ │ ├── model
│ │ │ │ ├── package-info.java
│ │ │ │ ├── Gender.java
│ │ │ │ ├── Airport.java
│ │ │ │ ├── Airline.java
│ │ │ │ ├── Weather.java
│ │ │ │ ├── CreditCard.java
│ │ │ │ └── Booking.java
│ │ │ ├── exception
│ │ │ │ ├── package-info.java
│ │ │ │ ├── NotFoundException.java
│ │ │ │ ├── ApiException.java
│ │ │ │ ├── BadRequestException.java
│ │ │ │ ├── ReviewRejectedException.java
│ │ │ │ ├── NotFoundExceptionMapper.java
│ │ │ │ └── ReviewRejectedExceptionMapper.java
│ │ │ └── resources
│ │ │ │ ├── package-info.java
│ │ │ │ └── PlayerService.java
│ │ ├── petstore
│ │ │ ├── package-info.java
│ │ │ ├── data
│ │ │ │ └── package-info.java
│ │ │ ├── model
│ │ │ │ ├── package-info.java
│ │ │ │ ├── Cat.java
│ │ │ │ ├── Dog.java
│ │ │ │ ├── Lizard.java
│ │ │ │ ├── Tag.java
│ │ │ │ ├── Category.java
│ │ │ │ ├── ApiResponse.java
│ │ │ │ ├── BadOrder.java
│ │ │ │ └── Order.java
│ │ │ ├── exception
│ │ │ │ ├── package-info.java
│ │ │ │ ├── ApiException.java
│ │ │ │ ├── NotFoundException.java
│ │ │ │ └── BadRequestException.java
│ │ │ └── resource
│ │ │ │ └── package-info.java
│ │ ├── beanvalidation
│ │ │ ├── TestGroup.java
│ │ │ ├── BeanValidationApp.java
│ │ │ └── BeanValidationResource.java
│ │ └── scanconfig
│ │ │ ├── ScanConfigApplication.java
│ │ │ ├── a
│ │ │ ├── AResource.java
│ │ │ └── b
│ │ │ │ ├── BResource.java
│ │ │ │ └── c
│ │ │ │ └── CResource.java
│ │ │ └── x
│ │ │ ├── XResource.java
│ │ │ └── y
│ │ │ └── YResource.java
│ │ ├── tck
│ │ ├── Groups.java
│ │ ├── OASConfigWebInfTest.java
│ │ ├── ModelReaderAppWithJustComponentTest.java
│ │ ├── ModelReaderAppWithJustWebHookTest.java
│ │ ├── OASConfigScanClassBase.java
│ │ ├── OASConfigScanDisableTest.java
│ │ ├── StaticDocumentCustomDialectTest.java
│ │ ├── utils
│ │ │ ├── ConfigAsset.java
│ │ │ └── YamlToJsonFilter.java
│ │ ├── beanvalidation
│ │ │ └── BeanValidationDisabledTest.java
│ │ └── OASConfigServersTest.java
│ │ └── reader
│ │ ├── MyOASModelReaderForJustComponentApp.java
│ │ └── MyOASModelReaderForJustWebHookApp.java
└── formatter.xml
├── spec
├── src
│ └── main
│ │ ├── asciidoc
│ │ ├── images
│ │ │ └── diagram.png
│ │ └── license-alv2.asciidoc
│ │ └── resources
│ │ └── META-INF
│ │ └── NOTICE
└── pom.xml
├── api
├── bnd.bnd
├── src
│ └── main
│ │ ├── resources
│ │ └── META-INF
│ │ │ └── NOTICE
│ │ └── java
│ │ ├── org
│ │ └── eclipse
│ │ │ └── microprofile
│ │ │ └── openapi
│ │ │ ├── spi
│ │ │ └── package-info.java
│ │ │ ├── annotations
│ │ │ ├── enums
│ │ │ │ ├── Explode.java
│ │ │ │ ├── ParameterIn.java
│ │ │ │ ├── SecuritySchemeIn.java
│ │ │ │ ├── SchemaType.java
│ │ │ │ ├── SecuritySchemeType.java
│ │ │ │ ├── package-info.java
│ │ │ │ └── ParameterStyle.java
│ │ │ ├── extensions
│ │ │ │ ├── package-info.java
│ │ │ │ └── Extensions.java
│ │ │ ├── media
│ │ │ │ ├── package-info.java
│ │ │ │ ├── DependentRequired.java
│ │ │ │ ├── DependentSchema.java
│ │ │ │ ├── DiscriminatorMapping.java
│ │ │ │ └── PatternProperty.java
│ │ │ ├── headers
│ │ │ │ └── package-info.java
│ │ │ ├── links
│ │ │ │ ├── package-info.java
│ │ │ │ └── LinkParameter.java
│ │ │ ├── responses
│ │ │ │ ├── package-info.java
│ │ │ │ └── APIResponses.java
│ │ │ ├── tags
│ │ │ │ ├── package-info.java
│ │ │ │ └── Tags.java
│ │ │ ├── parameters
│ │ │ │ ├── Parameters.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ ├── servers
│ │ │ │ ├── package-info.java
│ │ │ │ ├── Servers.java
│ │ │ │ └── ServerVariable.java
│ │ │ ├── security
│ │ │ │ ├── package-info.java
│ │ │ │ ├── OAuthScope.java
│ │ │ │ ├── SecuritySchemes.java
│ │ │ │ ├── SecurityRequirements.java
│ │ │ │ ├── SecurityRequirement.java
│ │ │ │ ├── OAuthFlows.java
│ │ │ │ └── SecurityRequirementsSets.java
│ │ │ ├── callbacks
│ │ │ │ ├── Callbacks.java
│ │ │ │ └── package-info.java
│ │ │ ├── info
│ │ │ │ ├── package-info.java
│ │ │ │ ├── License.java
│ │ │ │ └── Contact.java
│ │ │ └── ExternalDocumentation.java
│ │ │ ├── models
│ │ │ ├── Constructible.java
│ │ │ ├── callbacks
│ │ │ │ └── package-info.java
│ │ │ ├── tags
│ │ │ │ └── package-info.java
│ │ │ ├── security
│ │ │ │ └── package-info.java
│ │ │ ├── links
│ │ │ │ └── package-info.java
│ │ │ ├── media
│ │ │ │ └── package-info.java
│ │ │ ├── examples
│ │ │ │ └── package-info.java
│ │ │ ├── parameters
│ │ │ │ └── package-info.java
│ │ │ ├── headers
│ │ │ │ └── package-info.java
│ │ │ ├── servers
│ │ │ │ └── package-info.java
│ │ │ ├── responses
│ │ │ │ └── package-info.java
│ │ │ ├── info
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ └── ExternalDocumentation.java
│ │ │ ├── package-info.java
│ │ │ └── OASModelReader.java
│ │ └── module-info.java
└── pom.xml
├── spi
├── bnd.bnd
├── src
│ └── main
│ │ ├── resources
│ │ └── META-INF
│ │ │ └── NOTICE
│ │ └── java
│ │ └── org
│ │ └── eclipse
│ │ └── microprofile
│ │ └── openapi
│ │ └── spi
│ │ └── package-info.java
└── pom.xml
├── .gitignore
├── .github
├── workflows
│ └── build.yml
├── dependabot.yml
└── ISSUE_TEMPLATE
│ └── 01-compatible-certification-request.md
└── NOTICE
/tck/src/main/resources/META-INF/tck:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spec/src/main/asciidoc/images/diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microprofile/microprofile-open-api/HEAD/spec/src/main/asciidoc/images/diagram.png
--------------------------------------------------------------------------------
/api/bnd.bnd:
--------------------------------------------------------------------------------
1 | -exportcontents: \
2 | org.eclipse.microprofile.*
3 | Bundle-SymbolicName: org.eclipse.microprofile.openapi
4 | Bundle-Name: MicroProfile OpenAPI Bundle
5 | Bundle-License: Apache License, Version 2.0
--------------------------------------------------------------------------------
/spi/bnd.bnd:
--------------------------------------------------------------------------------
1 | -exportcontents: \
2 | org.eclipse.microprofile.*
3 | Bundle-SymbolicName: org.eclipse.microprofile.openapi
4 | Bundle-Name: MicroProfile OpenAPI Bundle
5 | Bundle-License: Apache License, Version 2.0
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .apt_generated/
3 | .settings/
4 | .checkstyle
5 | .classpath
6 | .project
7 | .factorypath
8 | .externalToolBuilders/
9 | bin/
10 | target/
11 | .idea
12 | *.iml
13 | *.ipr
14 | *.iws
15 | /**/nbactions.xml
16 | .vscode
17 |
--------------------------------------------------------------------------------
/spec/src/main/resources/META-INF/NOTICE:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to section 4(d) of the Apache License, ==
3 | == Version 2.0, in this case for MicroProfile OpenAPI ==
4 | =========================================================================
5 |
6 | SPDXVersion: SPDX-2.1
7 | PackageName: Eclipse MicroProfile
8 | PackageHomePage: http://www.eclipse.org/microprofile
9 | PackageLicenseDeclared: Apache-2.0
10 |
11 | PackageCopyrightText:
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | mp.openapi.scan.disable=true
--------------------------------------------------------------------------------
/api/src/main/resources/META-INF/NOTICE:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to section 4(d) of the Apache License, ==
3 | == Version 2.0, in this case for MicroProfile OpenAPI ==
4 | =========================================================================
5 |
6 | The majority of this software were originally based on the following:
7 | * Swagger Core
8 | https://github.com/swagger-api/swagger-core
9 | under Apache License, v2.0
10 |
11 |
12 | SPDXVersion: SPDX-2.1
13 | PackageName: Eclipse MicroProfile
14 | PackageHomePage: http://www.eclipse.org/microprofile
15 | PackageLicenseDeclared: Apache-2.0
16 |
17 | PackageCopyrightText:
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderImpl -------------------------------------------------------------------------------- /tck/src/main/resources/microprofile-config-filter.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | mp.openapi.filter=org.eclipse.microprofile.openapi.filter.AirlinesOASFilter -------------------------------------------------------------------------------- /tck/src/main/resources/class-microprofile-config.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | mp.openapi.scan.classes=org.eclipse.microprofile.openapi.apps.airlines.resources.ReviewResource -------------------------------------------------------------------------------- /tck/src/main/resources/microprofile-reader-just-webhook.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustWebHookApp -------------------------------------------------------------------------------- /tck/src/main/resources/microprofile-reader-just-component.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustComponentApp -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/filter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.filter; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.airlines; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.petstore; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/data/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.airlines.data; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.petstore.data; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.airlines.model; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.petstore.model; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.airlines.exception; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.airlines.resources; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.petstore.exception; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 5 | * the License. You may obtain a copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | @org.osgi.annotation.versioning.Version("1.0") 15 | package org.eclipse.microprofile.openapi.apps.petstore.resource; -------------------------------------------------------------------------------- /spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * Service provider interface which allows vendors to set their implementations of OASFactoryResolver. 16 | */ 17 | 18 | @org.osgi.annotation.versioning.Version("1.0") 19 | package org.eclipse.microprofile.openapi.spi; -------------------------------------------------------------------------------- /tck/src/main/resources/schema-microprofile-config.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | mp.openapi.schema.java.time.Instant = { \ 16 | "name": "EpochSeconds", \ 17 | "type": "number", \ 18 | "format": "int64", \ 19 | "title": "Epoch Seconds", \ 20 | "description": "Number of seconds from the epoch of 1970-01-01T00:00:00Z" \ 21 | } 22 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/beanvalidation/TestGroup.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.beanvalidation; 17 | 18 | /** 19 | * A non-default bean validation constraint group for the bean validation test 20 | */ 21 | public interface TestGroup { 22 | } 23 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.airlines.exception; 15 | 16 | public class NotFoundException extends ApiException { 17 | public NotFoundException(String msg) { 18 | super(404, msg); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/tck/Groups.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.tck; 17 | 18 | public class Groups { 19 | 20 | private Groups() { 21 | // no instances 22 | } 23 | 24 | public static final String BEAN_VALIDATION = "bean-validation"; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * Service provider interface which allows vendors to set their implementations of OASFactoryResolver. 16 | */ 17 | 18 | @org.osgi.annotation.versioning.Version("1.0") 19 | @org.osgi.annotation.versioning.ProviderType 20 | package org.eclipse.microprofile.openapi.spi; -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/Explode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | * Copyright 2017 SmartBear Software 4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.eclipse.microprofile.openapi.annotations.enums; 19 | 20 | /** 21 | * Enumeration used to define the value of Explode property. 22 | */ 23 | public enum Explode { 24 | DEFAULT, FALSE, TRUE; 25 | } 26 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/extensions/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * Annotations to represent additional data to extend existing OpenAPI specifications. 16 | */ 17 | 18 | @org.osgi.annotation.versioning.Version("1.1") 19 | @org.osgi.annotation.versioning.ProviderType 20 | package org.eclipse.microprofile.openapi.annotations.extensions; -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.airlines.exception; 15 | 16 | public class ApiException extends Exception { 17 | private int code; 18 | public ApiException(int code, String msg) { 19 | super(msg); 20 | this.code = code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/beanvalidation/BeanValidationApp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.beanvalidation; 17 | 18 | import jakarta.ws.rs.ApplicationPath; 19 | import jakarta.ws.rs.core.Application; 20 | 21 | @ApplicationPath("/") 22 | public class BeanValidationApp extends Application { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.exception; 15 | 16 | public class ApiException extends Exception { 17 | private int code; 18 | public ApiException(int code, String msg) { 19 | super(msg); 20 | this.code = code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/ScanConfigApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig; 17 | 18 | import jakarta.ws.rs.ApplicationPath; 19 | import jakarta.ws.rs.core.Application; 20 | 21 | @ApplicationPath("/") 22 | public class ScanConfigApplication extends Application { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/a/AResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig.a; 17 | 18 | import jakarta.ws.rs.GET; 19 | import jakarta.ws.rs.Path; 20 | 21 | @Path("a") 22 | public class AResource { 23 | 24 | @GET 25 | public String get() { 26 | return "a"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/a/b/BResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig.a.b; 17 | 18 | import jakarta.ws.rs.GET; 19 | import jakarta.ws.rs.Path; 20 | 21 | @Path("b") 22 | public class BResource { 23 | 24 | @GET 25 | public String get() { 26 | return "b"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/x/XResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig.x; 17 | 18 | import jakarta.ws.rs.GET; 19 | import jakarta.ws.rs.Path; 20 | 21 | @Path("x") 22 | public class XResource { 23 | 24 | @GET 25 | public String get() { 26 | return "x"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/x/y/YResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig.x.y; 17 | 18 | import jakarta.ws.rs.GET; 19 | import jakarta.ws.rs.Path; 20 | 21 | @Path("y") 22 | public class YResource { 23 | 24 | @GET 25 | public String get() { 26 | return "y"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/models/Constructible.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.eclipse.microprofile.openapi.models; 18 | 19 | /** 20 | * Marker interface for OpenAPI model objects that can be constructed by the OASFactory. 21 | * 22 | * @see org.eclipse.microprofile.openapi.OASFactory 23 | */ 24 | public interface Constructible { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/scanconfig/a/b/c/CResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.scanconfig.a.b.c; 17 | 18 | import jakarta.ws.rs.GET; 19 | import jakarta.ws.rs.Path; 20 | 21 | @Path("c") 22 | public class CResource { 23 | 24 | @GET 25 | public String get() { 26 | return "c"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.exception; 15 | 16 | public class NotFoundException extends ApiException { 17 | private int code; 18 | public NotFoundException(int code, String msg) { 19 | super(code, msg); 20 | this.code = code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.airlines.exception; 15 | 16 | public class BadRequestException extends ApiException { 17 | private int code; 18 | public BadRequestException(int code, String msg) { 19 | super(code, msg); 20 | this.code = code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.exception; 15 | 16 | public class BadRequestException extends ApiException { 17 | private int code; 18 | public BadRequestException(int code, String msg) { 19 | super(code, msg); 20 | this.code = code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * A set of Java interfaces, annotations and programming models which allow Java developers to natively produce OpenAPI 16 | * v3.1 documents from their Jakarta REST applications. 17 | */ 18 | 19 | @org.osgi.annotation.versioning.Version("2.1") 20 | @org.osgi.annotation.versioning.ProviderType 21 | package org.eclipse.microprofile.openapi; 22 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/Gender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2019 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.airlines.model; 17 | 18 | import org.eclipse.microprofile.openapi.annotations.media.Schema; 19 | 20 | /** 21 | * 22 | * @author jonathan coustick 23 | */ 24 | @Schema(enumeration = {"Male", "Female", "Other"}) 25 | public enum Gender { 26 | MALE, FEMALE, OTHER 27 | } 28 | -------------------------------------------------------------------------------- /tck/src/main/resources/server-microprofile-config.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | mp.openapi.servers=https://xyz.com/v1,https://abc.com/v1 16 | 17 | mp.openapi.servers.path./bookings/{id}=https://xyz.io/v1,https://xyz.io/v2 18 | mp.openapi.servers.path./user/createWithArray=https://xyz.io/v3 19 | 20 | mp.openapi.servers.operation.getBookingById=https://abc.io/v1 21 | mp.openapi.servers.operation.createReview=https://newreviewserver.io/v1,https://newreviewserver.io/v2 -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/models/callbacks/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * An interface to represent callback URL. 16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification. 18 | */ 19 | 20 | @org.osgi.annotation.versioning.Version("2.1") 21 | @org.osgi.annotation.versioning.ProviderType 22 | package org.eclipse.microprofile.openapi.models.callbacks; -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "maven" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | ignore: 13 | - dependency-name: "jakarta.*" # Don't offer updates for new Jakarta EE spec versions 14 | update-types: 15 | - version-update:semver-major 16 | - version-update:semver-minor 17 | - dependency-name: "org.eclipse.microprofile:microprofile-parent" # The major version of microprofile-parent is tied to the Jakarta EE version 18 | update-types: 19 | - version-update:semver-major 20 | - package-ecosystem: github-actions 21 | directory: "/" 22 | schedule: 23 | interval: weekly 24 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Cat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.model; 15 | 16 | import jakarta.xml.bind.annotation.XmlRootElement; 17 | 18 | @XmlRootElement(name = "Cat") 19 | public class Cat extends Pet { 20 | 21 | private String catBreed; 22 | 23 | public String getCatBreed() { 24 | return catBreed; 25 | } 26 | 27 | public void setCatBreed(String catBreed) { 28 | this.catBreed = catBreed; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Dog.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.model; 15 | 16 | import jakarta.xml.bind.annotation.XmlRootElement; 17 | 18 | @XmlRootElement(name = "Dog") 19 | public class Dog extends Pet { 20 | 21 | private String dogBreed; 22 | 23 | public String getDogBreed() { 24 | return dogBreed; 25 | } 26 | 27 | public void setDogBreed(String dogBreed) { 28 | this.dogBreed = dogBreed; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/ReviewRejectedException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | package org.eclipse.microprofile.openapi.apps.airlines.exception; 14 | 15 | @SuppressWarnings("serial") 16 | public class ReviewRejectedException extends Exception { 17 | 18 | public ReviewRejectedException(String rejectionReason, Throwable cause) { 19 | super(rejectionReason, cause); 20 | } 21 | 22 | public ReviewRejectedException(String rejectionReason) { 23 | super(rejectionReason); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Lizard.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.model; 15 | 16 | import jakarta.xml.bind.annotation.XmlRootElement; 17 | 18 | @XmlRootElement(name = "Lizard") 19 | public class Lizard extends Pet { 20 | 21 | private String lizardBreed; 22 | 23 | public String getLizardBreed() { 24 | return lizardBreed; 25 | } 26 | 27 | public void setLizardBreed(String lizardBreed) { 28 | this.lizardBreed = lizardBreed; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/ParameterIn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | * Copyright 2017 SmartBear Software 4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.eclipse.microprofile.openapi.annotations.enums; 19 | 20 | public enum ParameterIn { 21 | DEFAULT(""), HEADER("header"), QUERY("query"), PATH("path"), COOKIE("cookie"); 22 | 23 | private String value; 24 | 25 | ParameterIn(String value) { 26 | this.value = value; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return String.valueOf(value); 32 | } 33 | } -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeIn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | * Copyright 2017 SmartBear Software 4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.eclipse.microprofile.openapi.annotations.enums; 19 | 20 | public enum SecuritySchemeIn { 21 | DEFAULT(""), HEADER("header"), QUERY("query"), COOKIE("cookie"); 22 | 23 | private String value; 24 | 25 | SecuritySchemeIn(String value) { 26 | this.value = value; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return String.valueOf(value); 32 | } 33 | } -------------------------------------------------------------------------------- /tck/src/main/resources/customDialect.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 Contributors to the Eclipse Foundation 2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #
9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | openapi: 3.1.0 16 | info: 17 | title: Custom dialect schema example 18 | version: 1.0.0 19 | paths: 20 | /test: 21 | get: 22 | description: Returns data in a custom schema dialect 23 | responses: 24 | '200': 25 | content: 26 | application/json: 27 | schema: 28 | $schema: http://example.com/custom 29 | description: This is an example of a completely custom schema which should be passed through untouched 30 | foo: bar 31 | baz: qux -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * A set of annotations to represent input and output data type, media type and relevant examples. 16 | * 17 | *
18 | * Example usage: 19 | * 20 | *
21 | * content = {@literal @}Content(
22 | * examples = {@literal @}ExampleObject(
23 | * name = "example",
24 | * value = "1")))
25 | *
26 | */
27 |
28 | @org.osgi.annotation.versioning.Version("1.3.1")
29 | @org.osgi.annotation.versioning.ProviderType
30 | package org.eclipse.microprofile.openapi.annotations.media;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SchemaType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.enums;
19 |
20 | public enum SchemaType {
21 | INTEGER("integer"), NUMBER("number"), BOOLEAN("boolean"), STRING("string"), OBJECT("object"), ARRAY(
22 | "array"), DEFAULT("");
23 |
24 | private String value;
25 |
26 | SchemaType(String value) {
27 | this.value = value;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return String.valueOf(value);
33 | }
34 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/01-compatible-certification-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Compatible Certification Request
3 | about: Start a request for a compatible certification
4 | title: 'MicroProfile OpenAPI [Version] Compatible Certification Request'
5 | labels: 'Certification :trophy:'
6 | assignees: ''
7 |
8 | ---
9 |
10 | - [ ] Organization Name ("Organization") and, if applicable, URL:
11 | // Add here
12 | - [ ] Product Name, Version and download URL (if applicable):
13 | // Add here
14 | - [ ] Specification Name, Version and download URL:
15 | // Add here
16 | - [ ] (Optional) TCK Version, digital SHA-256 fingerprint and download URL:
17 | // Add here
18 | - [ ] Public URL of TCK Results Summary:
19 | // Add here
20 | - [ ] Any Additional Specification Certification Requirements:
21 | // Add here
22 | - [ ] Java runtime used to run the implementation:
23 | // Add here
24 | - [ ] Summary of the information for the certification environment, operating system, cloud, ...:
25 | // Add here
26 | - [ ] By checking this box I acknowledge that the Organization I represent accepts the terms of the [EFTL](https://www.eclipse.org/legal/tck.php).
27 | - [ ] By checking this box I attest that all TCK requirements have been met, including any compatibility rules.
28 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.eclipse.microprofile.openapi.annotations.enums; 19 | 20 | public enum SecuritySchemeType { 21 | DEFAULT(""), APIKEY("apiKey"), HTTP("http"), OPENIDCONNECT("openIdConnect"), OAUTH2("oauth2"), MUTUALTLS( 22 | "mutualTLS"); 23 | 24 | private String value; 25 | 26 | SecuritySchemeType(String value) { 27 | this.value = value; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return String.valueOf(value); 33 | } 34 | } -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * An annotation to describe a single header object. 16 | *
17 | * Example usage: 18 | * 19 | *
20 | * {@literal @}GET
21 | * {@literal @}APIResponse(
22 | * responseCode = "200",
23 | * description = "successful operation",
24 | * headers = {@literal @}Header(ref="#/components/headers/Request-Limit")
25 | * )
26 | *
27 | */
28 |
29 | @org.osgi.annotation.versioning.Version("1.1")
30 | @org.osgi.annotation.versioning.ProviderType
31 | package org.eclipse.microprofile.openapi.annotations.headers;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * A set of parameters used by other annotations to represent their enumerable properties. This package contains enums 16 | * for the following annotations: 17 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | *
11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.eclipse.microprofile.openapi.annotations.enums; 19 | 20 | public enum ParameterStyle { 21 | DEFAULT(""), MATRIX("matrix"), LABEL("label"), FORM("form"), SPACEDELIMITED("spaceDelimited"), PIPEDELIMITED( 22 | "pipeDelimited"), DEEPOBJECT( 23 | "deepObject"), SIMPLE("simple"); 24 | 25 | private String value; 26 | 27 | ParameterStyle(String value) { 28 | this.value = value; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return String.valueOf(value); 34 | } 35 | } -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.model; 15 | 16 | import jakarta.xml.bind.annotation.XmlElement; 17 | import jakarta.xml.bind.annotation.XmlRootElement; 18 | 19 | @XmlRootElement(name = "Tag") 20 | public class Tag { 21 | private long id; 22 | private String name; 23 | 24 | @XmlElement(name = "id") 25 | public long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(long id) { 30 | this.id = id; 31 | } 32 | 33 | @XmlElement(name = "name") 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | package org.eclipse.microprofile.openapi.apps.petstore.model; 15 | 16 | import jakarta.xml.bind.annotation.XmlElement; 17 | import jakarta.xml.bind.annotation.XmlRootElement; 18 | 19 | @XmlRootElement(name = "Category") 20 | public class Category { 21 | private long id; 22 | private String name; 23 | 24 | @XmlElement(name = "id") 25 | public long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(long id) { 30 | this.id = id; 31 | } 32 | 33 | @XmlElement(name = "name") 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tck/src/main/java/org/eclipse/microprofile/openapi/apps/beanvalidation/BeanValidationResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *
10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.eclipse.microprofile.openapi.apps.beanvalidation; 17 | 18 | import jakarta.validation.Valid; 19 | import jakarta.validation.constraints.Size; 20 | import jakarta.ws.rs.Consumes; 21 | import jakarta.ws.rs.POST; 22 | import jakarta.ws.rs.Path; 23 | import jakarta.ws.rs.PathParam; 24 | import jakarta.ws.rs.core.MediaType; 25 | 26 | @Path("/") 27 | public class BeanValidationResource { 28 | 29 | @POST 30 | @Consumes(MediaType.APPLICATION_JSON) 31 | public void test(@Valid BeanValidationData data) { 32 | } 33 | 34 | @POST 35 | @Path("parameter/{test}") 36 | public void test(@PathParam("test") @Size(max = 6) String size) { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation 3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * Annotations to represent a design-time link for a response and the corresponding parameter to be passed to the linked 16 | * operation. 17 | *
18 | * Example usage: 19 | * 20 | *
21 | * {@literal @}APIResponse(
22 | * responseCode="201",
23 | * description="review created",
24 | * links = {
25 | * {@literal @}Link(
26 | * name="Review",
27 | * description="get the review that was added",
28 | * operationId="getReviewById"
29 | * }
30 | * )
31 | *
32 | */
33 |
34 | @org.osgi.annotation.versioning.Version("1.1")
35 | @org.osgi.annotation.versioning.ProviderType
36 | package org.eclipse.microprofile.openapi.annotations.links;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations 11 | * under the License. 12 | */ 13 | 14 | /** 15 | * Contains annotation to describe a single response from an API operation, and an annotation to encapsulate multiple 16 | * responses from an API operation. 17 | *
18 | * Example usage: 19 | * 20 | *
21 | * {@literal @}GET
22 | * {@literal @}Path("{id}")
23 | * {@literal @}APIResponse(
24 | * responseCode="200",
25 | * description="Review retrieved",
26 | * content={@literal @}Content(
27 | * schema={@literal @}Schema(
28 | * implementation=Review.class))
29 | * )
30 | *
31 | */
32 |
33 | @org.osgi.annotation.versioning.Version("1.2")
34 | @org.osgi.annotation.versioning.ProviderType
35 | package org.eclipse.microprofile.openapi.annotations.responses;
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/Airport.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a 5 | * copy of the License at 6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.model;
15 |
16 | import java.util.List;
17 |
18 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
19 |
20 | public class Airport {
21 |
22 | @Schema(required = true)
23 | private List
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.annotations.extensions;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * This object represents an array of extensions that can be added to the element.
27 | **/
28 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE})
29 | @Retention(RetentionPolicy.RUNTIME)
30 | @Inherited
31 | public @interface Extensions {
32 | /**
33 | * An array of Extension annotations
34 | *
35 | * @return the array of the extensions
36 | **/
37 | Extension[] value() default {};
38 |
39 | }
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations to represent a tag for an API endpoint and a container that encapsulates multiple such tags.
16 | *
17 | * Example usage:
18 | *
19 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.tck;
18 |
19 | import org.jboss.arquillian.container.test.api.Deployment;
20 | import org.jboss.shrinkwrap.api.ShrinkWrap;
21 | import org.jboss.shrinkwrap.api.spec.WebArchive;
22 |
23 | public class OASConfigWebInfTest extends OASConfigScanClassBase {
24 |
25 | @Deployment(name = "airlinesWebInf", testable = false)
26 | public static WebArchive createDeployment() {
27 | return ShrinkWrap.create(WebArchive.class, "airlinesWebInf.war")
28 | .addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
29 | .addAsWebInfResource("class-microprofile-config.properties",
30 | "classes/META-INF/microprofile-config.properties");
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/tags/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * Model interface to represent a tag of an API endpoint.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of model interfaces to represent various security components of an OpenAPI app.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.parameters;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Inherited;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * This object encapsulates input parameters
28 | *
29 | * @see OpenAPI Specification Parameter Object
30 | */
31 | @Retention(RetentionPolicy.RUNTIME)
32 | @Target({ElementType.METHOD})
33 | @Inherited
34 | public @interface Parameters {
35 | /**
36 | * An array of Parameter Objects for the operation
37 | *
38 | * @return the parameters
39 | */
40 | Parameter[] value() default {};
41 | }
42 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/exception/NotFoundExceptionMapper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2020 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.exception;
15 |
16 | import org.eclipse.microprofile.openapi.annotations.media.Content;
17 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
18 | import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
19 | import org.eclipse.microprofile.openapi.apps.airlines.model.User;
20 |
21 | import jakarta.ws.rs.core.Response;
22 | import jakarta.ws.rs.ext.ExceptionMapper;
23 |
24 | public class NotFoundExceptionMapper implements ExceptionMapper
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations, many derived from Swagger Core library. OpenAPI annotations can be augmented with existing
16 | * Jakarta REST annotations in an application to produce a valid OpenAPI document.
17 | *
18 | * Examples of annotations in this package include:
19 | *
26 | * Example of usage:
27 | *
28 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * Annotations to represent servers used for a single API operation or for all operations in an OpenAPI document, as
16 | * well as a way to represent variables for server URL template substitution.
17 | *
18 | * Example usage:
19 | *
20 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.annotations.media;
17 |
18 | import java.lang.annotation.Target;
19 |
20 | /**
21 | * A property name and an associated list of other property names.
22 | *
23 | * Used with {@link Schema#dependentRequired()}, if an object has a property named {@link #name()}, it must also have
24 | * properties with the names in {@link #requires()}.
25 | *
26 | * @see Schema#dependentRequired()
27 | * @since 4.0
28 | */
29 | @Target({})
30 | public @interface DependentRequired {
31 |
32 | /**
33 | * The property name to look for
34 | *
35 | * @return a property name
36 | */
37 | String name();
38 |
39 | /**
40 | * The property names that an object is required to have, if it has a property named {@link #name()}
41 | *
42 | * @return the required property names
43 | */
44 | String[] requires();
45 | }
46 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations to describe and encapsulate operation parameters and operation's request body.
16 | *
17 | * Example usage:
18 | *
19 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * An interface of a model to represent a design-time link for a response.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.annotations.media;
17 |
18 | import java.lang.annotation.Target;
19 |
20 | /**
21 | * A property name and an associated schema.
22 | *
23 | * Used with {@link Schema#dependentSchemas()}, if an instance has a property named {@link #name()}, then it must
24 | * validate against {@link #schema()}.
25 | *
26 | * @see Schema#dependentSchemas()
27 | * @since 4.0
28 | */
29 | @Target({})
30 | public @interface DependentSchema {
31 |
32 | /**
33 | * A property name
34 | *
35 | * @return property name
36 | */
37 | String name();
38 |
39 | /**
40 | * The schema that an instance must validate against if it has a property named {@link #name()}.
41 | *
42 | * @return a class used to generate a schema which is used to validate objects with properties named {@link #name()}
43 | */
44 | Class> schema();
45 | }
46 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/PlayerService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2018 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.resources;
15 |
16 | import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
17 |
18 | import jakarta.ws.rs.GET;
19 | import jakarta.ws.rs.HeaderParam;
20 | import jakarta.ws.rs.POST;
21 | import jakarta.ws.rs.Path;
22 | import jakarta.ws.rs.PathParam;
23 | import jakarta.ws.rs.Produces;
24 | import jakarta.ws.rs.QueryParam;
25 | import jakarta.ws.rs.core.MediaType;
26 |
27 | @RegisterRestClient
28 | @Path("/")
29 | public interface PlayerService {
30 |
31 | @GET
32 | @Path("/player/{playerId}")
33 | @Produces(MediaType.APPLICATION_JSON)
34 | public String getPlayerById(@PathParam("playerId") String id);
35 |
36 | @POST
37 | @Path("/rank/{playerId}/recordGame")
38 | public void recordGame(@PathParam("playerId") String id, @QueryParam("place") int place,
39 | @HeaderParam("Authorization") String token);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations to represent various security components of an OpenAPI app.
16 | *
17 | *
18 | * Example usage:
19 | *
20 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.security;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Represents an OAuth scope.
27 | *
28 | * @see OpenAPI Specification OAuth Flow
29 | * Object
30 | **/
31 | @Target({})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Inherited
34 | public @interface OAuthScope {
35 | /**
36 | * Name of the scope.
37 | *
38 | * @return the name of this scope
39 | */
40 | String name() default "";
41 |
42 | /**
43 | * Short description of the scope.
44 | *
45 | * @return the description of this scope
46 | */
47 | String description() default "";
48 | }
49 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/LinkParameter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.links;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Represents a parameter to pass to an operation as specified with operationId or identified via operationRef.
27 | **/
28 | @Target({})
29 | @Retention(RetentionPolicy.RUNTIME)
30 | @Inherited
31 | public @interface LinkParameter {
32 | /**
33 | * The name of this link parameter.
34 | *
35 | * @return the parameter's name
36 | **/
37 | String name() default "";
38 |
39 | /**
40 | * A constant or an expression to be evaluated and passed to the linked operation.
41 | *
42 | * @return the parameter's literal value or expression
43 | **/
44 | String expression() default "";
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.annotations.security;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * This object represents an array of SecurityScheme annotations that can be specified at the definition level.
27 | *
28 | * @see OpenAPI Specification Security Scheme
29 | * Object
30 | **/
31 | @Target({ElementType.TYPE})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Inherited
34 | public @interface SecuritySchemes {
35 | /**
36 | * An array of SecurityScheme annotations that can be specified at definition level.
37 | *
38 | * @return the array of the SecurityScheme annotations
39 | **/
40 | SecurityScheme[] value() default {};
41 |
42 | }
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.callbacks;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Inherited;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * This object represents an array of Callback URLs that can be invoked.
28 | *
29 | * @see OpenAPI Specification Callback Object
30 | **/
31 | @Target({ElementType.METHOD})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Inherited
34 | public @interface Callbacks {
35 | /**
36 | * An array of Callback annotations which are a map of possible out-of band callbacks related to the parent
37 | * operation
38 | *
39 | * @return the array of the callbacks
40 | **/
41 | Callback[] value() default {};
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/Airline.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.model;
15 |
16 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
17 |
18 | @Schema(additionalProperties = Schema.True.class)
19 | public class Airline {
20 |
21 | @Schema(required = true, example = "Acme Air")
22 | private String name;
23 |
24 | @Schema(required = true, example = "1-888-1234-567")
25 | private String contactPhone;
26 |
27 | private Airline() {
28 | }
29 |
30 | public Airline(String name, String contactPhone) {
31 | this.name = name;
32 | this.contactPhone = contactPhone;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public String getContactPhone() {
44 | return contactPhone;
45 | }
46 |
47 | public void setContactPhone(String contactPhone) {
48 | this.contactPhone = contactPhone;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations to represent metadata about the API, including license information and contact information of
16 | * the exposed API.
17 | *
18 | * Example usage:
19 | *
20 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of interfaces for programmable models to represent input and output data types and media types.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.media;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * This object maps payload values to a particular Schema.
27 | *
28 | * @see OpenAPI Specification Discriminator
29 | * Object
30 | **/
31 | @Target({})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Inherited
34 | public @interface DiscriminatorMapping {
35 |
36 | /**
37 | * The property value that will be mapped to a Schema
38 | *
39 | * @return the property value
40 | **/
41 | String value() default "";
42 |
43 | /**
44 | * The schema that is being mapped to a property value
45 | *
46 | * @return the Schema reference
47 | **/
48 | Class> schema() default Void.class;
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/tck/formatter.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.annotations.media;
17 |
18 | import java.lang.annotation.Retention;
19 | import java.lang.annotation.RetentionPolicy;
20 | import java.lang.annotation.Target;
21 |
22 | /**
23 | * A regular expression and an associated schema.
24 | *
25 | * Used with {@link Schema#patternProperties()}, properties with names that match {@link #regex()} must have values
26 | * which validate against {@link #schema()}.
27 | *
28 | * @see Schema#patternProperties()
29 | * @since 4.0
30 | */
31 | @Target({})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | public @interface PatternProperty {
34 |
35 | /**
36 | * A regular expression to match against property names.
37 | *
38 | * @return an ECMA-262 regular expression
39 | */
40 | String regex();
41 |
42 | /**
43 | * A schema that a property value must validate against
44 | *
45 | * @return a class used to generate a schema used to validate properties with names that match {@link #regex()}
46 | */
47 | Class> schema();
48 | }
49 |
--------------------------------------------------------------------------------
/spi/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * An interface to represent a programmable model of an example of a data type or a media type.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of model interfaces to describe operation parameters and operation's request body.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.tck;
18 |
19 | import static org.hamcrest.Matchers.equalTo;
20 |
21 | import org.jboss.arquillian.container.test.api.Deployment;
22 | import org.jboss.shrinkwrap.api.ShrinkWrap;
23 | import org.jboss.shrinkwrap.api.spec.WebArchive;
24 | import org.testng.annotations.Test;
25 |
26 | import io.restassured.response.ValidatableResponse;
27 |
28 | public class ModelReaderAppWithJustComponentTest extends AppTestBase {
29 | @Deployment(name = "airlinesModelReader", testable = false)
30 | public static WebArchive createDeployment() {
31 | return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war")
32 | .addPackages(true, "org.eclipse.microprofile.openapi.reader")
33 | .addAsManifestResource("microprofile-reader-just-component.properties",
34 | "microprofile-config.properties");
35 | }
36 |
37 | @Test(dataProvider = "formatProvider")
38 | public void testDocumentCreated(String type) {
39 | ValidatableResponse vr = callEndpoint(type);
40 | vr.body("components.schemas.id.format", equalTo("int32"));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.tck;
18 |
19 | import static org.hamcrest.Matchers.equalTo;
20 |
21 | import org.jboss.arquillian.container.test.api.Deployment;
22 | import org.jboss.shrinkwrap.api.ShrinkWrap;
23 | import org.jboss.shrinkwrap.api.spec.WebArchive;
24 | import org.testng.annotations.Test;
25 |
26 | import io.restassured.response.ValidatableResponse;
27 |
28 | public class ModelReaderAppWithJustWebHookTest extends AppTestBase {
29 | @Deployment(name = "airlinesModelReader", testable = false)
30 | public static WebArchive createDeployment() {
31 | return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war")
32 | .addPackages(true, "org.eclipse.microprofile.openapi.reader")
33 | .addAsManifestResource("microprofile-reader-just-webhook.properties", "microprofile-config.properties");
34 | }
35 |
36 | @Test(dataProvider = "formatProvider")
37 | public void testDocumentCreated(String type) {
38 | ValidatableResponse vr = callEndpoint(type);
39 | vr.body("webhooks.MarketEvent.get.summary", equalTo("Notifies that a deal has been done"));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/headers/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * An interface of a programmable model to represent a single header object.
16 | *
17 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
18 | *
19 | * Example usage:
20 | *
21 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.annotations.security;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Container annotation for repeated {@link SecurityRequirement} annotations.
27 | *
28 | * Note that each {@code SecurityRequirement} annotation is equivalent to a {@link SecurityRequirementsSet}
29 | * annotation containing only that annotation.
30 | *
31 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * Model interfaces to represent servers used for a single API operation or for all operations in an OpenAPI document,
16 | * as well as a way to represent variables for server URL template substitution.
17 | *
18 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
19 | *
20 | * Example usage:
21 | *
22 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * Model interfaces to describe a single response from an API operation, and an annotation to encapsulate multiple
16 | * responses from an API operation.
17 | *
18 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
19 | *
20 | * Example usage:
21 | *
22 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi;
17 |
18 | import org.eclipse.microprofile.openapi.models.OpenAPI;
19 |
20 | /**
21 | * This interface allows application developers to programmatically contribute an OpenAPI model tree.
22 | *
23 | * In this scenario the developer can choose whether to provide the entire OpenAPI model while disabling annotation
24 | * scanning, or they can provide a starting OpenAPI model to be augmented with the application annotations.
25 | *
26 | * The registration of this model reader is controlled by setting the key mp.openapi.model.reader using one of
27 | * the configuration sources specified in MicroProfile
28 | * Config. The value is the fully qualified name of the model reader implementation, which needs to be visible to
29 | * the application's classloader.
30 | */
31 | public interface OASModelReader {
32 |
33 | /**
34 | * This method is called by the vendor's OpenAPI processing framework. It can be a fully complete and valid OpenAPI
35 | * model tree, or a partial base model tree that will be augmented by either annotations or pre-generated OpenAPI
36 | * documents.
37 | *
38 | * @return the OpenAPI model to be used by the vendor
39 | */
40 | OpenAPI buildModel();
41 | }
42 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/Weather.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.model;
15 |
16 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
17 |
18 | public class Weather {
19 | @Schema(required = true)
20 | private String date;
21 |
22 | @Schema(required = true)
23 | private String city;
24 |
25 | @Schema(required = true)
26 | private String weather;
27 |
28 | @Schema(required = true)
29 | private int temperture;
30 |
31 | @Schema(required = true)
32 | private String narrative;
33 |
34 | public Weather() {
35 | this.narrative = "Weather information is not yet available.";
36 | }
37 |
38 | public Weather(String date, String city, String weather, int temperture, String narrative) {
39 | this.date = date;
40 | this.city = city;
41 | this.weather = weather;
42 | this.temperture = temperture;
43 | this.narrative = narrative;
44 | }
45 |
46 | public String getDate() {
47 | return date;
48 | }
49 |
50 | public String getCity() {
51 | return city;
52 | }
53 |
54 | public String getWeath() {
55 | return weather;
56 | }
57 |
58 | public int getTemperture() {
59 | return temperture;
60 | }
61 |
62 | public String getNarrative() {
63 | return narrative;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.eclipse.microprofile.openapi.annotations.servers;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | *
27 | * The Servers annotation is a container for @Server annotations. When used on a method or a type it is treated as if
28 | * each server annotation were applied individually.
29 | *
30 | * Note: If both {@link org.eclipse.microprofile.openapi.annotations.servers.Server Server} and
31 | * {@link org.eclipse.microprofile.openapi.annotations.servers.Servers Servers} annotation are specified on the same
32 | * type, the server definitions will be combined.
33 | *
34 | * @see OpenAPI Specification Server Object
35 | *
36 | */
37 | @Target({ElementType.TYPE, ElementType.METHOD})
38 | @Retention(RetentionPolicy.RUNTIME)
39 | @Inherited
40 | public @interface Servers {
41 | /**
42 | * An array of Server objects which is used to provide connectivity information to a target server.
43 | *
44 | * @return the servers used for this API or endpoint.
45 | */
46 | Server[] value() default {};
47 | }
48 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.annotations.responses;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
26 |
27 | /**
28 | * The ApiResponses annotation is a container for @ApiResponse annotations. When used on a method it is treated as if
29 | * each ApiResponse annotation were applied individually.
30 | *
31 | * @see OpenAPI Specification Responses Object
32 | **/
33 | @Target({ElementType.METHOD, ElementType.TYPE})
34 | @Retention(RetentionPolicy.RUNTIME)
35 | @Inherited
36 | public @interface APIResponses {
37 | /**
38 | * An array of APIResponse annotations
39 | *
40 | * @return the array of the APIResponse
41 | **/
42 | APIResponse[] value() default {};
43 |
44 | /**
45 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.responses.APIResponses
46 | * APIResponses} model corresponding to the containing annotation.
47 | *
48 | * @return array of extensions
49 | *
50 | * @since 3.1
51 | */
52 | Extension[] extensions() default {};
53 | }
54 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of annotations to represent callback URL or an array of relevant callback URLs that can be invoked for a
16 | * particular HTTP operation as well as the HTTP operation that will be invoked with the callback.
17 | *
18 | * Example annotation:
19 | *
20 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of interfaces of programmable models to represent metadata about the API, including license information and
16 | * contact information of the exposed API.
17 | *
18 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
19 | *
20 | * Example:
21 | *
22 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.tck;
18 |
19 | import static org.hamcrest.Matchers.hasKey;
20 | import static org.hamcrest.Matchers.startsWith;
21 | import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
22 |
23 | import org.testng.annotations.Test;
24 |
25 | import io.restassured.response.ValidatableResponse;
26 |
27 | /**
28 | * Base class for config scan classes.
29 | */
30 | public abstract class OASConfigScanClassBase extends AppTestBase {
31 | private ValidatableResponse vr;
32 |
33 | @Test(dataProvider = "formatProvider")
34 | public void testScanClass(String type) throws InterruptedException {
35 | vr = callEndpoint(type);
36 | vr.body("openapi", startsWith("3.1."));
37 | vr.body("paths", aMapWithSize(5));
38 | vr.body("paths", hasKey("/reviews"));
39 | vr.body("paths", hasKey("/reviews/{id}"));
40 | vr.body("paths", hasKey("/reviews/users/{user}"));
41 | vr.body("paths", hasKey("/reviews/airlines/{airline}"));
42 | vr.body("paths", hasKey("/reviews/{user}/{airlines}"));
43 |
44 | vr.body("paths.'/reviews'", aMapWithSize(2));
45 | vr.body("paths.'/reviews/{id}'", aMapWithSize(2));
46 | vr.body("paths.'/reviews/users/{user}'", aMapWithSize(1));
47 | vr.body("paths.'/reviews/airlines/{airline}'", aMapWithSize(1));
48 | vr.body("paths.'/reviews/{user}/{airlines}'", aMapWithSize(1));
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanDisableTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.eclipse.microprofile.openapi.tck;
18 |
19 | import static org.hamcrest.Matchers.notNullValue;
20 | import static org.hamcrest.Matchers.startsWith;
21 | import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
22 |
23 | import org.jboss.arquillian.container.test.api.Deployment;
24 | import org.jboss.shrinkwrap.api.ShrinkWrap;
25 | import org.jboss.shrinkwrap.api.spec.WebArchive;
26 | import org.testng.annotations.Test;
27 |
28 | import io.restassured.response.ValidatableResponse;
29 |
30 | public class OASConfigScanDisableTest extends AppTestBase {
31 | private ValidatableResponse vr;
32 |
33 | @Deployment(name = "airlines", testable = false)
34 | public static WebArchive createDeployment() {
35 | return ShrinkWrap.create(WebArchive.class, "airlines.war")
36 | .addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
37 | .addAsManifestResource("scan-disable-microprofile-config.properties", "microprofile-config.properties");
38 | }
39 |
40 | @Test(dataProvider = "formatProvider")
41 | public void testScanDisable(String type) throws InterruptedException {
42 | vr = callEndpoint(type);
43 | vr.body("openapi", startsWith("3.1."));
44 | vr.body("info", notNullValue());
45 | vr.body("info.title", notNullValue());
46 | vr.body("info.version", notNullValue());
47 | vr.body("paths", aMapWithSize(0));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentCustomDialectTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.tck;
17 |
18 | import static org.hamcrest.Matchers.equalTo;
19 | import static org.hamcrest.Matchers.startsWith;
20 |
21 | import org.jboss.arquillian.container.test.api.Deployment;
22 | import org.jboss.shrinkwrap.api.ShrinkWrap;
23 | import org.jboss.shrinkwrap.api.spec.WebArchive;
24 | import org.testng.annotations.Test;
25 |
26 | import io.restassured.response.ValidatableResponse;
27 |
28 | /**
29 | * Test that a static document can contain a schema with a custom dialect
30 | */
31 | public class StaticDocumentCustomDialectTest extends AppTestBase {
32 |
33 | @Deployment(name = "customdialect", testable = false)
34 | public static WebArchive createDeployment() {
35 | return ShrinkWrap.create(WebArchive.class, "customdialect.war")
36 | .addAsManifestResource("customDialect.yaml", "openapi.yaml");
37 | }
38 |
39 | @Test(dataProvider = "formatProvider")
40 | public void testStaticDocumentCustomDialect(String type) {
41 | ValidatableResponse vr = callEndpoint(type);
42 |
43 | vr.body("openapi", startsWith("3.1."));
44 |
45 | final String schemaPath = "paths.'/test'.get.responses.'200'.content.'application/json'.schema";
46 | vr.body(schemaPath + ".$schema", equalTo("http://example.com/custom"));
47 | vr.body(schemaPath + ".foo", equalTo("bar"));
48 | vr.body(schemaPath + ".baz", equalTo("qux"));
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * A set of interfaces for programmable models and their helper classes, many derived from Swagger Core library. These
16 | * interfaces can be used to define OpenAPI document programmatically.
17 | *
18 | * The behaviour of methods inherited from java.lang.Object are undefined by the MicroProfile OpenAPI specification.
19 | *
20 | * Example:
21 | *
22 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.tags;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Inherited;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * The Tags annotation is a container for @Tag annotations. When used on a method or a type it is treated as if each tag
28 | * annotation were applied individually.
29 | *
30 | * Note: If both {@link org.eclipse.microprofile.openapi.annotations.tags.Tag Tag} and
31 | * {@link org.eclipse.microprofile.openapi.annotations.tags.Tags Tags} annotations are specified on the same
32 | * method/class, then both tag definitions should be applied to method/class.
33 | *
34 | * @see OpenAPI Specification Tag Object
35 | *
36 | */
37 | @Target({ElementType.TYPE, ElementType.METHOD})
38 | @Retention(RetentionPolicy.RUNTIME)
39 | @Inherited
40 | public @interface Tags {
41 | /**
42 | * An array of Tag annotation objects which hold metadata for the API
43 | *
44 | * @return an array of Tag annotations
45 | */
46 | Tag[] value() default {};
47 |
48 | /**
49 | * An array of referenced Tag objects which hold metadata for the API
50 | *
51 | * @return an array of references to tags
52 | **/
53 | String[] refs() default "";
54 | }
55 |
--------------------------------------------------------------------------------
/api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.info;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
26 |
27 | /**
28 | * License information for the exposed API.
29 | *
30 | * @see OpenAPI Specification License Object
31 | **/
32 | @Target({})
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Inherited
35 | public @interface License {
36 | /**
37 | * The license name used for the API.
38 | *
39 | * @return the name of the license
40 | **/
41 | String name();
42 |
43 | /**
44 | * The license identifier used for the API.
45 | *
46 | * @return the identifier of the license
47 | * @since 4.0
48 | **/
49 | String identifier() default "";
50 |
51 | /**
52 | * A URL to the license used for the API. MUST be in the format of a URL.
53 | *
54 | * @return the URL of the license
55 | **/
56 | String url() default "";
57 |
58 | /**
59 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.info.License License} model
60 | * corresponding to the containing annotation.
61 | *
62 | * @return array of extensions
63 | *
64 | * @since 3.1
65 | */
66 | Extension[] extensions() default {};
67 | }
68 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.reader;
17 |
18 | import java.util.HashMap;
19 |
20 | import org.eclipse.microprofile.openapi.OASFactory;
21 | import org.eclipse.microprofile.openapi.OASModelReader;
22 | import org.eclipse.microprofile.openapi.models.Components;
23 | import org.eclipse.microprofile.openapi.models.OpenAPI;
24 | import org.eclipse.microprofile.openapi.models.info.Contact;
25 | import org.eclipse.microprofile.openapi.models.info.Info;
26 | import org.eclipse.microprofile.openapi.models.media.Schema;
27 |
28 | public class MyOASModelReaderForJustComponentApp implements OASModelReader {
29 |
30 | @Override
31 | public OpenAPI buildModel() {
32 | return OASFactory.createObject(OpenAPI.class)
33 | .info(OASFactory.createObject(Info.class)
34 | .title("MarketApp API")
35 | .version("1.0")
36 | .termsOfService("http://example.com/terms")
37 | .contact(OASFactory.createObject(Contact.class)
38 | .name("market API Support")
39 | .url("http://example.com/contact")
40 | .email("admin@example.com")))
41 | .components(OASFactory.createObject(Components.class)
42 | .schemas(new HashMap
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 | package org.eclipse.microprofile.openapi.apps.airlines.exception;
14 |
15 | import org.eclipse.microprofile.openapi.annotations.media.Content;
16 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
17 | import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
18 | import org.eclipse.microprofile.openapi.apps.airlines.exception.ReviewRejectedExceptionMapper.RejectionResponse;
19 |
20 | import jakarta.ws.rs.core.MediaType;
21 | import jakarta.ws.rs.core.Response;
22 | import jakarta.ws.rs.core.Response.Status;
23 | import jakarta.ws.rs.ext.ExceptionMapper;
24 |
25 | @APIResponse(responseCode = "400", description = "The review was rejected",
26 | content = @Content(mediaType = MediaType.APPLICATION_JSON,
27 | schema = @Schema(implementation = RejectionResponse.class)))
28 | public class ReviewRejectedExceptionMapper implements ExceptionMapper
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.info;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
26 |
27 | /**
28 | * Contact information for the exposed API.
29 | *
30 | * @see OpenAPI Specification Contact Object
31 | **/
32 | @Target({})
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Inherited
35 | public @interface Contact {
36 | /**
37 | * The identifying name of the contact person/organization.
38 | *
39 | * @return the name of the contact
40 | **/
41 | String name() default "";
42 |
43 | /**
44 | * The URL pointing to the contact information. Must be in the format of a URL.
45 | *
46 | * @return the URL of the contact
47 | **/
48 | String url() default "";
49 |
50 | /**
51 | * The email address of the contact person/organization. Must be in the format of an email address.
52 | *
53 | * @return the email address of the contact
54 | **/
55 | String email() default "";
56 |
57 | /**
58 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.info.Contact Contact} model
59 | * corresponding to the containing annotation.
60 | *
61 | * @return array of extensions
62 | *
63 | * @since 3.1
64 | */
65 | Extension[] extensions() default {};
66 | }
67 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/ConfigAsset.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.tck.utils;
17 |
18 | import java.io.ByteArrayInputStream;
19 | import java.io.ByteArrayOutputStream;
20 | import java.io.IOException;
21 | import java.io.InputStream;
22 | import java.util.Properties;
23 |
24 | import org.jboss.shrinkwrap.api.asset.Asset;
25 |
26 | /**
27 | * Utility to allow the contents of microprofile-config.properties to be defined within the deployment method
28 | *
29 | * Example usage:
30 | *
31 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.reader;
17 |
18 | import org.eclipse.microprofile.openapi.OASFactory;
19 | import org.eclipse.microprofile.openapi.OASModelReader;
20 | import org.eclipse.microprofile.openapi.models.OpenAPI;
21 | import org.eclipse.microprofile.openapi.models.info.Contact;
22 | import org.eclipse.microprofile.openapi.models.info.Info;
23 |
24 | public class MyOASModelReaderForJustWebHookApp implements OASModelReader {
25 |
26 | @Override
27 | public OpenAPI buildModel() {
28 | return OASFactory.createObject(OpenAPI.class)
29 | .info(OASFactory.createObject(Info.class)
30 | .title("MarketApp API")
31 | .version("1.0")
32 | .termsOfService("http://example.com/terms")
33 | .contact(OASFactory.createObject(Contact.class)
34 | .name("market API Support")
35 | .url("http://example.com/contact")
36 | .email("admin@example.com")))
37 | .addWebhook("MarketEvent", OASFactory.createPathItem()
38 | .GET(OASFactory.createOperation()
39 | .summary("Notifies that a deal has been done")
40 | .responses(OASFactory.createAPIResponses()
41 | .addAPIResponse("202", OASFactory.createAPIResponse()
42 | .description(
43 | "Indicates that the deal was processed successfully")))));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/CreditCard.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.model;
15 |
16 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
17 |
18 | @Schema(additionalProperties = Schema.False.class)
19 | public class CreditCard {
20 |
21 | @Schema(required = true, example = "VISA")
22 | private String issuer;
23 |
24 | @Schema(required = true, example = "Joe Smith")
25 | private String cardholderName;
26 |
27 | @Schema(required = true, example = "**********1234")
28 | private String cardNumber;
29 |
30 | @Schema(required = true, example = "0322")
31 | private String cvv;
32 |
33 | @Schema(required = true, example = "04/19")
34 | private String expiryDate;
35 |
36 | private CreditCard() {
37 | }
38 |
39 | public String getIssuer() {
40 | return issuer;
41 | }
42 |
43 | public void setIssuer(String issuer) {
44 | this.issuer = issuer;
45 | }
46 |
47 | public String getCardholderName() {
48 | return cardholderName;
49 | }
50 |
51 | public void setCardholderName(String cardholderName) {
52 | this.cardholderName = cardholderName;
53 | }
54 |
55 | public String getCardNumber() {
56 | return cardNumber;
57 | }
58 |
59 | public void setCardNumber(String cardNumber) {
60 | this.cardNumber = cardNumber;
61 | }
62 |
63 | public String getCvv() {
64 | return cvv;
65 | }
66 |
67 | public void setCvv(String cvv) {
68 | this.cvv = cvv;
69 | }
70 |
71 | public String getExpiryDate() {
72 | return expiryDate;
73 | }
74 |
75 | public void setExpiryDate(String expiryDate) {
76 | this.expiryDate = expiryDate;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/Booking.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.airlines.model;
15 |
16 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
17 |
18 | public class Booking {
19 |
20 | @Schema(required = true)
21 | private Flight departtureFlight;
22 |
23 | @Schema(required = true)
24 | private Flight returningFlight;
25 |
26 | @Schema(required = true)
27 | private CreditCard creditCard;
28 |
29 | @Schema(required = true, example = "32126319")
30 | private String airMiles;
31 |
32 | @Schema(required = true, example = "window")
33 | private String seatPreference;
34 |
35 | private Booking() {
36 | }
37 |
38 | public Flight getDeparttureFlight() {
39 | return departtureFlight;
40 | }
41 |
42 | public void setDeparttureFlight(Flight departtureFlight) {
43 | this.departtureFlight = departtureFlight;
44 | }
45 |
46 | public Flight getReturningFlight() {
47 | return returningFlight;
48 | }
49 |
50 | public void setReturningFlight(Flight returningFlight) {
51 | this.returningFlight = returningFlight;
52 | }
53 |
54 | public CreditCard getCreditCard() {
55 | return creditCard;
56 | }
57 |
58 | public void setCreditCard(CreditCard creditCard) {
59 | this.creditCard = creditCard;
60 | }
61 |
62 | public String getAirMiles() {
63 | return airMiles;
64 | }
65 |
66 | public void setAirMiles(String airMiles) {
67 | this.airMiles = airMiles;
68 | }
69 |
70 | public String getSeatPreference() {
71 | return seatPreference;
72 | }
73 |
74 | public void setSeatPreference(String seatPreference) {
75 | this.seatPreference = seatPreference;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationDisabledTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.tck.beanvalidation;
17 |
18 | import static org.eclipse.microprofile.openapi.tck.Groups.BEAN_VALIDATION;
19 | import static org.eclipse.microprofile.openapi.tck.beanvalidation.BeanValidationTest.assertProperty;
20 | import static org.hamcrest.Matchers.hasKey;
21 | import static org.hamcrest.Matchers.not;
22 |
23 | import org.eclipse.microprofile.openapi.OASConfig;
24 | import org.eclipse.microprofile.openapi.apps.beanvalidation.BeanValidationApp;
25 | import org.eclipse.microprofile.openapi.tck.AppTestBase;
26 | import org.jboss.arquillian.container.test.api.Deployment;
27 | import org.jboss.shrinkwrap.api.ShrinkWrap;
28 | import org.jboss.shrinkwrap.api.asset.Asset;
29 | import org.jboss.shrinkwrap.api.asset.StringAsset;
30 | import org.jboss.shrinkwrap.api.spec.WebArchive;
31 | import org.testng.annotations.Test;
32 |
33 | import io.restassured.response.ValidatableResponse;
34 |
35 | public class BeanValidationDisabledTest extends AppTestBase {
36 |
37 | @Deployment(testable = false)
38 | public static WebArchive buildApp() {
39 | Asset config = new StringAsset(OASConfig.SCAN_BEANVALIDATION + "=false");
40 |
41 | return ShrinkWrap.create(WebArchive.class, "beanValidation.war")
42 | .addPackage(BeanValidationApp.class.getPackage())
43 | .addAsManifestResource(config, "microprofile-config.properties");
44 | }
45 |
46 | @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION)
47 | public void beanValidationScanningDisabledTest(String format) {
48 | ValidatableResponse vr = callEndpoint(format);
49 | assertProperty(vr, "notEmptyString", not(hasKey("minLength")));
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.security;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Inherited;
22 | import java.lang.annotation.Repeatable;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.RetentionPolicy;
25 | import java.lang.annotation.Target;
26 |
27 | /**
28 | * Specifies a security requirement for an operation.
29 | *
30 | * Applying this annotation to a method or class is equivalent to applying a {@link SecurityRequirementsSet} annotation
31 | * containing only this annotation.
32 | *
33 | * @see OpenAPI Specification Security
34 | * Requirement Object
35 | **/
36 | @Target({ElementType.METHOD, ElementType.TYPE})
37 | @Retention(RetentionPolicy.RUNTIME)
38 | @Repeatable(SecurityRequirements.class)
39 | @Inherited
40 | public @interface SecurityRequirement {
41 | /**
42 | * Name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object.
43 | *
44 | * @return the name of this Security Requirement instance
45 | */
46 | String name();
47 |
48 | /**
49 | * If the security scheme referred by the name property is of type "oauth2" or "openIdConnect", then the scopes
50 | * array is a list of scope names required for the execution.
51 | *
52 | * For other security scheme types, the array MAY contain a list of required roles.
53 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.petstore.model;
15 |
16 | import jakarta.xml.bind.annotation.XmlTransient;
17 |
18 | @jakarta.xml.bind.annotation.XmlRootElement
19 | public class ApiResponse {
20 | public static final int ERROR = 1;
21 | public static final int WARNING = 2;
22 | public static final int INFO = 3;
23 | public static final int OK = 4;
24 | public static final int TOO_BUSY = 5;
25 |
26 | private int code;
27 | private String type;
28 | private String message;
29 |
30 | public ApiResponse() {
31 | }
32 |
33 | public ApiResponse(int code, String message) {
34 | this.code = code;
35 | switch (code) {
36 | case ERROR :
37 | setType("error");
38 | break;
39 | case WARNING :
40 | setType("warning");
41 | break;
42 | case INFO :
43 | setType("info");
44 | break;
45 | case OK :
46 | setType("ok");
47 | break;
48 | case TOO_BUSY :
49 | setType("too busy");
50 | break;
51 | default :
52 | setType("unknown");
53 | break;
54 | }
55 | this.message = message;
56 | }
57 |
58 | @XmlTransient
59 | public int getCode() {
60 | return code;
61 | }
62 |
63 | public void setCode(int code) {
64 | this.code = code;
65 | }
66 |
67 | public String getType() {
68 | return type;
69 | }
70 |
71 | public void setType(String type) {
72 | this.type = type;
73 | }
74 |
75 | public String getMessage() {
76 | return message;
77 | }
78 |
79 | public void setMessage(String message) {
80 | this.message = message;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.security;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
26 |
27 | /**
28 | * Allows configuration of the supported OAuth Flows.
29 | *
30 | * @see OpenAPI Specification OAuth Flows
31 | * Object
32 | **/
33 | @Target({})
34 | @Retention(RetentionPolicy.RUNTIME)
35 | @Inherited
36 | public @interface OAuthFlows {
37 | /**
38 | * Configuration for the OAuth Implicit flow.
39 | *
40 | * @return implicit OAuth flow
41 | **/
42 | OAuthFlow implicit() default @OAuthFlow();
43 |
44 | /**
45 | * Configuration for the OAuth Resource Owner Password flow.
46 | *
47 | * @return OAuth Resource Owner Password flow
48 | **/
49 | OAuthFlow password() default @OAuthFlow();
50 |
51 | /**
52 | * Configuration for the OAuth Client Credentials flow.
53 | *
54 | * @return OAuth Client Credentials flow
55 | **/
56 | OAuthFlow clientCredentials() default @OAuthFlow();
57 |
58 | /**
59 | * Configuration for the OAuth Authorization Code flow.
60 | *
61 | * @return OAuth Authorization Code flow
62 | **/
63 | OAuthFlow authorizationCode() default @OAuthFlow();
64 |
65 | /**
66 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.security.OAuthFlows
67 | * OAuthFlows} model corresponding to the containing annotation.
68 | *
69 | * @return array of extensions
70 | *
71 | * @since 3.1
72 | */
73 | Extension[] extensions() default {};
74 | }
75 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/BadOrder.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.petstore.model;
15 |
16 | import java.util.Date;
17 |
18 | import jakarta.xml.bind.annotation.XmlElement;
19 | import jakarta.xml.bind.annotation.XmlRootElement;
20 |
21 | @XmlRootElement(name = "Order")
22 | public class BadOrder {
23 | private long errorCode;
24 | private long id;
25 | private long petId;
26 | private int quantity;
27 | private Date shipDate;
28 | private String status;
29 | private boolean complete;
30 |
31 | public long getErrorCode() {
32 | return errorCode;
33 | }
34 |
35 | @XmlElement(name = "id")
36 | public long getId() {
37 | return id;
38 | }
39 |
40 | public void setId(long id) {
41 | this.id = id;
42 | }
43 |
44 | public boolean isComplete() {
45 | return complete;
46 | }
47 |
48 | public void setComplete(boolean complete) {
49 | this.complete = complete;
50 | }
51 |
52 | @XmlElement(name = "petId")
53 | public long getPetId() {
54 | return petId;
55 | }
56 |
57 | public void setPetId(long petId) {
58 | this.petId = petId;
59 | }
60 |
61 | @XmlElement(name = "quantity")
62 | public int getQuantity() {
63 | return quantity;
64 | }
65 |
66 | public void setQuantity(int quantity) {
67 | this.quantity = quantity;
68 | }
69 |
70 | @XmlElement(name = "status")
71 | // @ApiModelProperty(value = "Order Status", allowableValues = "placed, approved, delivered")
72 | public String getStatus() {
73 | return status;
74 | }
75 |
76 | public void setStatus(String status) {
77 | this.status = status;
78 | }
79 |
80 | @XmlElement(name = "shipDate")
81 | public Date getShipDate() {
82 | return shipDate;
83 | }
84 |
85 | public void setShipDate(Date shipDate) {
86 | this.shipDate = shipDate;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Order.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.apps.petstore.model;
15 |
16 | import java.util.Date;
17 |
18 | import org.eclipse.microprofile.openapi.annotations.media.Schema;
19 |
20 | import jakarta.xml.bind.annotation.XmlElement;
21 | import jakarta.xml.bind.annotation.XmlRootElement;
22 |
23 | @XmlRootElement(name = "Order")
24 | public class Order {
25 | @Schema(required = true) // discriminator
26 | private long id;
27 | private long petId;
28 | private int quantity;
29 | private Date shipDate;
30 | private String status;
31 | private boolean complete;
32 |
33 | @XmlElement(name = "id")
34 | public long getId() {
35 | return id;
36 | }
37 |
38 | public void setId(long id) {
39 | this.id = id;
40 | }
41 |
42 | public boolean isComplete() {
43 | return complete;
44 | }
45 |
46 | public void setComplete(boolean complete) {
47 | this.complete = complete;
48 | }
49 |
50 | @XmlElement(name = "petId")
51 | public long getPetId() {
52 | return petId;
53 | }
54 |
55 | public void setPetId(long petId) {
56 | this.petId = petId;
57 | }
58 |
59 | @XmlElement(name = "quantity")
60 | public int getQuantity() {
61 | return quantity;
62 | }
63 |
64 | public void setQuantity(int quantity) {
65 | this.quantity = quantity;
66 | }
67 |
68 | @XmlElement(name = "status")
69 | // @ApiModelProperty(value = "Order Status", allowableValues = "placed, approved, delivered")
70 | public String getStatus() {
71 | return status;
72 | }
73 |
74 | public void setStatus(String status) {
75 | this.status = status;
76 | }
77 |
78 | @XmlElement(name = "shipDate")
79 | public Date getShipDate() {
80 | return shipDate;
81 | }
82 |
83 | public void setShipDate(Date shipDate) {
84 | this.shipDate = shipDate;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/YamlToJsonFilter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2018 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.tck.utils;
17 |
18 | import org.apache.commons.lang3.exception.ExceptionUtils;
19 |
20 | import com.fasterxml.jackson.databind.ObjectMapper;
21 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
22 |
23 | import io.restassured.builder.ResponseBuilder;
24 | import io.restassured.filter.FilterContext;
25 | import io.restassured.filter.OrderedFilter;
26 | import io.restassured.http.ContentType;
27 | import io.restassured.response.Response;
28 | import io.restassured.specification.FilterableRequestSpecification;
29 | import io.restassured.specification.FilterableResponseSpecification;
30 |
31 | /**
32 | * This filter is a replacement for the original {@code YamlToJsonConverterServlet}.
33 | *
34 | * Its only purpose is to convert YAML to JSON so that tests can use JsonPath to inspect the response body.
35 | *
36 | * @author Martin Kouba
37 | */
38 | public class YamlToJsonFilter implements OrderedFilter {
39 |
40 | @Override
41 | public Response filter(FilterableRequestSpecification requestSpec, FilterableResponseSpecification responseSpec,
42 | FilterContext ctx) {
43 | try {
44 | Response response = ctx.next(requestSpec, responseSpec);
45 |
46 | ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
47 | Object obj = yamlReader.readValue(response.getBody().asString(), Object.class);
48 |
49 | ObjectMapper jsonWriter = new ObjectMapper();
50 | String json = jsonWriter.writeValueAsString(obj);
51 |
52 | ResponseBuilder builder = new ResponseBuilder();
53 | builder.clone(response);
54 | builder.setBody(json);
55 | builder.setContentType(ContentType.JSON);
56 |
57 | return builder.build();
58 | } catch (Exception e) {
59 | throw new IllegalStateException("Failed to convert the request: " + ExceptionUtils.getMessage(e), e);
60 | }
61 | }
62 |
63 | @Override
64 | public int getOrder() {
65 | return OrderedFilter.HIGHEST_PRECEDENCE;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations;
19 |
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Inherited;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
27 |
28 | /**
29 | * This annotation allows referencing an external resource for extended documentation.
30 | *
31 | * When it is applied to a method the value of the annotation is added to the corresponding OpenAPI operation
32 | * definition.
33 | *
34 | * When it is applied to a type and one or more of the fields are not empty strings the annotation value is added to the
35 | * OpenAPI document root. If more than one non-empty annotation is applied to a type in the application or if the
36 | * externalDocs field of the OpenAPIDefinition annotation is supplied the results are not defined.
37 | *
38 | * @see OpenAPI Specification
39 | * External Documentation Object
40 | **/
41 | @Target({ElementType.METHOD, ElementType.TYPE})
42 | @Retention(RetentionPolicy.RUNTIME)
43 | @Inherited
44 | public @interface ExternalDocumentation {
45 |
46 | /**
47 | * A short description of the target documentation.
48 | *
49 | * @return the documentation description
50 | **/
51 | String description() default "";
52 |
53 | /**
54 | * The URL for the target documentation. Value must be in the format of a URL.
55 | *
56 | * @return the documentation URL
57 | **/
58 | String url() default "";
59 |
60 | /**
61 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.ExternalDocumentation
62 | * ExternalDocumentation} model corresponding to the containing annotation.
63 | *
64 | * @return array of extensions
65 | *
66 | * @since 3.1
67 | */
68 | Extension[] extensions() default {};
69 | }
70 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSets.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.eclipse.microprofile.openapi.annotations.security;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.ElementType.TYPE;
20 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
21 |
22 | import java.lang.annotation.Inherited;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Represents an array of security requirement sets that apply to an operation. Only one of requirement sets needs be
28 | * satisfied to access the operation.
29 | *
30 | * If this annotation is applied to a method which corresponds to an operation, then the requirements will be added to
31 | * that operation.
32 | *
33 | * If this annotation is applied to a class which contains methods which correspond to operations, then the requirements
34 | * will be added to all operations corresponding to methods within that class which don't specify any other
35 | * requirements.
36 | *
37 | * This annotation may be used with {@code value} set to an empty array. When applied like this to a method or class, it
38 | * indicates that no security requirements apply to the corresponding operations. This can be used to override security
39 | * requirements which are specified for the whole API.
40 | *
41 | * A {@code SecurityRequirementSets} annotation corresponds to an array of maps of security requirements in an OpenAPI
42 | * document.
43 | *
44 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.annotations.servers;
19 |
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | import org.eclipse.microprofile.openapi.annotations.extensions.Extension;
26 |
27 | /**
28 | * An object representing a Server Variable for server URL template substitution.
29 | *
30 | * @see OpenAPI Specification Server
31 | * Variable Object
32 | **/
33 | @Target({})
34 | @Retention(RetentionPolicy.RUNTIME)
35 | @Inherited
36 | public @interface ServerVariable {
37 | /**
38 | * The name of this server variable. This is a REQUIRED property.
39 | *
40 | * @return the name of the server variable
41 | **/
42 | String name();
43 |
44 | /**
45 | * An array of enum values for this variable. This field maps to the enum property in the OAS schema and to
46 | * enumeration field of ServerVariable model.
47 | *
48 | * @return array of possible values for this ServerVariable
49 | **/
50 | String[] enumeration() default {};
51 |
52 | /**
53 | * The default value of this server variable. This is a REQUIRED property.
54 | *
55 | * If {@code enumeration} is set the default value MUST be one of the values in {@code enumeration}.
56 | *
57 | * @return the default value of this server variable
58 | **/
59 | String defaultValue();
60 |
61 | /**
62 | * An optional description for the server variable. CommonMark syntax can be used for rich text representation.
63 | *
64 | * @return the description of this server variable
65 | **/
66 | String description() default "";
67 |
68 | /**
69 | * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.servers.ServerVariable
70 | * ServerVariable} model corresponding to the containing annotation.
71 | *
72 | * @return array of extensions
73 | *
74 | * @since 3.1
75 | */
76 | Extension[] extensions() default {};
77 | }
78 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigServersTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017, 2018 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | package org.eclipse.microprofile.openapi.tck;
15 |
16 | import static org.hamcrest.Matchers.contains;
17 | import static org.hamcrest.Matchers.containsInAnyOrder;
18 | import static org.hamcrest.Matchers.hasSize;
19 |
20 | import org.jboss.arquillian.container.test.api.Deployment;
21 | import org.jboss.shrinkwrap.api.ShrinkWrap;
22 | import org.jboss.shrinkwrap.api.spec.WebArchive;
23 | import org.testng.annotations.Test;
24 |
25 | import io.restassured.response.ValidatableResponse;
26 |
27 | public class OASConfigServersTest extends AppTestBase {
28 | private ValidatableResponse vr;
29 |
30 | @Deployment(name = "airlines", testable = false)
31 | public static WebArchive createDeployment() {
32 | return ShrinkWrap.create(WebArchive.class, "airlines.war")
33 | .addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
34 | .addAsManifestResource("server-microprofile-config.properties", "microprofile-config.properties");
35 | }
36 |
37 | @Test(dataProvider = "formatProvider")
38 | public void testServer(String type) throws InterruptedException {
39 | vr = callEndpoint(type);
40 |
41 | vr.body("servers.findAll { it }.url", hasSize(2));
42 | vr.body("servers.findAll { it }.url", containsInAnyOrder("https://xyz.com/v1", "https://abc.com/v1"));
43 |
44 | vr.body("paths.'/bookings/{id}'.servers.findAll { it }.url", hasSize(2));
45 | vr.body("paths.'/bookings/{id}'.servers.findAll { it }.url",
46 | containsInAnyOrder("https://xyz.io/v1", "https://xyz.io/v2"));
47 |
48 | vr.body("paths.'/user/createWithArray'.servers.findAll { it }.url", hasSize(1));
49 | vr.body("paths.'/user/createWithArray'.servers.findAll { it }.url", contains("https://xyz.io/v3"));
50 |
51 | vr.body("paths.'/bookings/{id}'.get.servers.findAll { it }.url", hasSize(1));
52 | vr.body("paths.'/bookings/{id}'.get.servers.findAll { it }.url", contains("https://abc.io/v1"));
53 |
54 | vr.body("paths.'/reviews'.post.servers.findAll { it }.url", hasSize(2));
55 | vr.body("paths.'/reviews'.post.servers.findAll { it }.url",
56 | containsInAnyOrder("https://newreviewserver.io/v1", "https://newreviewserver.io/v2"));
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/api/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
5 | * copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
11 | * under the License.
12 | */
13 |
14 | /**
15 | * Eclipse MicroProfile OpenAPI
16 | *
17 | * A set of Java interfaces, annotations, and programming models which allow Java developers to natively produce OpenAPI
18 | * documents from Jakarta RESTful Web Services applications.
19 | */
20 | @SuppressWarnings("module") // silence warning about unstable name `osgi.annotation`
21 | module org.eclipse.microprofile.openapi {
22 |
23 | exports org.eclipse.microprofile.openapi;
24 | exports org.eclipse.microprofile.openapi.annotations;
25 | exports org.eclipse.microprofile.openapi.annotations.callbacks;
26 | exports org.eclipse.microprofile.openapi.annotations.enums;
27 | exports org.eclipse.microprofile.openapi.annotations.extensions;
28 | exports org.eclipse.microprofile.openapi.annotations.headers;
29 | exports org.eclipse.microprofile.openapi.annotations.info;
30 | exports org.eclipse.microprofile.openapi.annotations.links;
31 | exports org.eclipse.microprofile.openapi.annotations.media;
32 | exports org.eclipse.microprofile.openapi.annotations.parameters;
33 | exports org.eclipse.microprofile.openapi.annotations.responses;
34 | exports org.eclipse.microprofile.openapi.annotations.security;
35 | exports org.eclipse.microprofile.openapi.annotations.servers;
36 | exports org.eclipse.microprofile.openapi.annotations.tags;
37 | exports org.eclipse.microprofile.openapi.models;
38 | exports org.eclipse.microprofile.openapi.models.callbacks;
39 | exports org.eclipse.microprofile.openapi.models.examples;
40 | exports org.eclipse.microprofile.openapi.models.headers;
41 | exports org.eclipse.microprofile.openapi.models.info;
42 | exports org.eclipse.microprofile.openapi.models.links;
43 | exports org.eclipse.microprofile.openapi.models.media;
44 | exports org.eclipse.microprofile.openapi.models.parameters;
45 | exports org.eclipse.microprofile.openapi.models.responses;
46 | exports org.eclipse.microprofile.openapi.models.security;
47 | exports org.eclipse.microprofile.openapi.models.servers;
48 | exports org.eclipse.microprofile.openapi.models.tags;
49 | exports org.eclipse.microprofile.openapi.spi;
50 |
51 | uses org.eclipse.microprofile.openapi.spi.OASFactoryResolver;
52 |
53 | // Required for compilation, not used at runtime
54 | requires static osgi.annotation;
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/ExternalDocumentation.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.eclipse.microprofile.openapi.models;
19 |
20 | /**
21 | * ExternalDocumentation
22 | *
23 | * Allows referencing an external resource for extended documentation.
24 | *
25 | *
26 | * @see OpenAPI Specification
27 | * External Documentation Object
28 | */
29 | public interface ExternalDocumentation extends Constructible, Extensible
20 | * {@literal @}Path("/reviews")
21 | * {@literal @}Tags(
22 | * value = {
23 | * {@literal @}Tag(
24 | * name = "Reviews",
25 | * description = "All the review methods"
26 | * ),
27 | * {@literal @}Tag(
28 | * name = "Ratings",
29 | * description = "All the ratings methods"
30 | * )
31 | * }
32 | * )
33 | * public class ReviewResource {
34 | * ...
35 | *
36 | */
37 |
38 | @org.osgi.annotation.versioning.Version("1.1")
39 | package org.eclipse.microprofile.openapi.annotations.tags;
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigWebInfTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2018 Contributors to the Eclipse Foundation
3 | *
22 | * {@literal @}Override
23 | * public OpenAPI buildModel() {
24 | * return OASFactory.createObject(OpenAPI.class)
25 | * .tags(new ArrayList<Tag>())
26 | * .addTag(OASFactory.createObject(Tag.class)
27 | * .name("Get Airlines")
28 | * .description("method to get all airlines"))
29 | *
30 | */
31 |
32 | @org.osgi.annotation.versioning.Version("1.1")
33 | @org.osgi.annotation.versioning.ProviderType
34 | package org.eclipse.microprofile.openapi.models.tags;
--------------------------------------------------------------------------------
/spec/src/main/asciidoc/license-alv2.asciidoc:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | [subs="normal"]
18 | ....
19 |
20 | Specification: {doctitle}
21 |
22 | Version: {revnumber}
23 |
24 | Status: {revremark}
25 |
26 | Release: {revdate}
27 |
28 | Copyright (c) 2017 Contributors to the Eclipse Foundation
29 |
30 | Licensed under the Apache License, Version 2.0 (the "License");
31 | you may not use this file except in compliance with the License.
32 | You may obtain a copy of the License at
33 |
34 | http://www.apache.org/licenses/LICENSE-2.0
35 |
36 | Unless required by applicable law or agreed to in writing, software
37 | distributed under the License is distributed on an "AS IS" BASIS,
38 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 | See the License for the specific language governing permissions and
40 | limitations under the License.
41 |
42 | ....
43 |
--------------------------------------------------------------------------------
/spec/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
22 | * {@literal @}Override
23 | * public OpenAPI buildModel() {
24 | * return OASFactory.createObject(OpenAPI.class)
25 | * .security(new ArrayList<SecurityRequirement>())
26 | * .addSecurityRequirement(OASFactory.createObject(SecurityRequirement.class)
27 | * .addScheme("airlinesRatingApp_auth"))
28 | *
29 | */
30 |
31 | @org.osgi.annotation.versioning.Version("2.2")
32 | @org.osgi.annotation.versioning.ProviderType
33 | package org.eclipse.microprofile.openapi.models.security;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
20 | *
25 | *
29 | * {@literal @}GET
30 | * {@literal @}Path("/findByStatus")
31 | * {@literal @}Operation(summary = "Finds Pets by status",
32 | * description = "Multiple status values can be provided with comma separated strings")
33 | * public Response findPetsByStatus(...) { ... }
34 | *
35 | */
36 |
37 | @org.osgi.annotation.versioning.Version("1.2")
38 | package org.eclipse.microprofile.openapi.annotations;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
21 | * {@literal @}POST
22 | * {@literal @}Servers(value={
23 | * {@literal @}Server(url = "localhost:9080/{proxyPath}/reviews/id",
24 | * description = "view of all the reviews",
25 | * variables = { {@literal @}ServerVariable(name = "proxyPath", description = "Base path of the proxy", defaultValue = "proxy") }),
26 | * {@literal @}Server(url = "http://random.url/reviews", description = "random text")
27 | * })
28 | *
29 | */
30 |
31 | @org.osgi.annotation.versioning.Version("1.1")
32 | @org.osgi.annotation.versioning.ProviderType
33 | package org.eclipse.microprofile.openapi.annotations.servers;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
20 | * {@literal @}Produces("application/json")
21 | * public Response getReviewById(
22 | * {@literal @}Parameter(
23 | * name = "id",
24 | * description = "ID of the booking",
25 | * required = true,
26 | * in = ParameterIn.PATH,
27 | * content = {@literal @}Content(
28 | * examples = {@literal @}ExampleObject(
29 | * name = "example",
30 | * value = "1")))
31 | * {@literal @}PathParam("id") int id)
32 | *
33 | */
34 |
35 | @org.osgi.annotation.versioning.Version("1.2.1")
36 | @org.osgi.annotation.versioning.ProviderType
37 | package org.eclipse.microprofile.openapi.annotations.parameters;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/links/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
22 | * .components(OASFactory.createObject(Components.class)
23 | * .links(new HashMap<String, Link>())
24 | * .addLink("UserName", OASFactory.createObject(Link.class)
25 | * .description("The username corresponding to provided user id")
26 | * .operationId("getUserByName")
27 | * .parameters(new HashMap<String, Object>())
28 | * .addParameter("userId", "$request.link-path.userId")))
29 | *
30 | */
31 |
32 | @org.osgi.annotation.versioning.Version("1.1")
33 | @org.osgi.annotation.versioning.ProviderType
34 | package org.eclipse.microprofile.openapi.models.links;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
21 | * {@literal @}Path("/reviews")
22 | * {@literal @}SecurityScheme(
23 | * securitySchemeName = "reviewoauth2",
24 | * type = SecuritySchemeType.OAUTH2,
25 | * description = "authentication needed to create and delete reviews",
26 | * flows = {@literal @}OAuthFlows(
27 | * implicit = {@literal @}OAuthFlow(
28 | * authorizationUrl = "https://example.com/api/oauth/dialog",
29 | * scopes = {@literal @}OAuthScope(
30 | * name = "write:reviews",
31 | * description = "create a review"
32 | * )
33 | * )
34 | * )
35 | * )
36 | *
37 | */
38 |
39 | @org.osgi.annotation.versioning.Version("1.1")
40 | @org.osgi.annotation.versioning.ProviderType
41 | package org.eclipse.microprofile.openapi.annotations.security;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
21 | * {@literal @}ApplicationPath("/")
22 | {@literal @}OpenAPIDefinition(
23 | info = {@literal @}Info(
24 | title="AirlinesRatingApp API",
25 | version = "1.0",
26 | termsOfService = "http://airlinesratingapp.com/terms",
27 | contact = {@literal @}Contact(
28 | name = "AirlinesRatingApp API Support",
29 | url = "http://exampleurl.com/contact",
30 | email = "techsupport@airlinesratingapp.com"),
31 | license = {@literal @}License(
32 | name = "Apache 2.0",
33 | url = "http://www.apache.org/licenses/LICENSE-2.0.html")))
34 | *
35 | */
36 |
37 | @org.osgi.annotation.versioning.Version("1.2")
38 | @org.osgi.annotation.versioning.ProviderType
39 | package org.eclipse.microprofile.openapi.annotations.info;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
22 | * .responses(OASFactory.createObject(APIResponses.class)
23 | * .addApiResponse("200", OASFactory.createObject(APIResponse.class)
24 | * .description("Bookings retrieved")
25 | * .content(OASFactory.createObject(Content.class)
26 | * .addMediaType("applictaion/json", OASFactory.createObject(MediaType.class)
27 | * .schema(OASFactory.createObject(Schema.class)
28 | * .type(Schema.SchemaType.ARRAY)
29 | * .ref("#/components.schemas.Booking")))))
30 | *
31 | */
32 |
33 | @org.osgi.annotation.versioning.Version("3.1")
34 | @org.osgi.annotation.versioning.ProviderType
35 | package org.eclipse.microprofile.openapi.models.media;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
22 | * .components(OASFactory.createObject(Components.class)
23 | * .examples(new HashMap<String, Example>())
24 | * .addExample("review", OASFactory.createObject(Example.class)
25 | * .summary("External review example")
26 | * .description("This example exemplifies the content on our site.")
27 | * .externalValue("http://foo.bar/examples/review-example.json"))
28 | * .addExample("user", OASFactory.createObject(Example.class)
29 | * .summary("External user example")
30 | * .externalValue("http://foo.bar/examples/user-example.json"))
31 | *
32 | */
33 |
34 | @org.osgi.annotation.versioning.Version("1.1")
35 | @org.osgi.annotation.versioning.ProviderType
36 | package org.eclipse.microprofile.openapi.models.examples;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
22 | * .components(OASFactory.createObject(Components.class)
23 | * .parameters(new HashMap<String, Parameter>())
24 | * .addParameter("departureDate", OASFactory.createObject(Parameter.class)
25 | * .required(true)
26 | * .description("Customer departure date")
27 | * .schema(OASFactory.createObject(Schema.class)))
28 | * .addParameter("username", OASFactory.createObject(Parameter.class)
29 | * .required(true)
30 | * .description("The name that needs to be deleted")
31 | * .schema(OASFactory.createObject(Schema.class)))
32 | *
33 | */
34 |
35 | @org.osgi.annotation.versioning.Version("1.1")
36 | @org.osgi.annotation.versioning.ProviderType
37 | package org.eclipse.microprofile.openapi.models.parameters;
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
22 | * .components(OASFactory.createObject(Components.class)
23 | * .headers(new HashMap<String, Header>())
24 | * .addHeader("Max-Rate", OASFactory.createObject(Header.class)
25 | * .description("Maximum rate")
26 | * .schema(OASFactory.createObject(Schema.class)
27 | * .type(Schema.SchemaType.INTEGER))
28 | * .required(true)
29 | * .allowEmptyValue(true)
30 | * .deprecated(true))
31 | * .addHeader("Request-Limit", OASFactory.createObject(Header.class)
32 | * .description("The number of allowed requests in the current period")
33 | * .schema(OASFactory.createObject(Schema.class)
34 | * .type(Schema.SchemaType.INTEGER)))
35 | *
36 | */
37 |
38 | @org.osgi.annotation.versioning.Version("1.1")
39 | @org.osgi.annotation.versioning.ProviderType
40 | package org.eclipse.microprofile.openapi.models.headers;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 SmartBear Software
3 | *
32 | * Example:
33 | * security:
34 | * - oauth_implicit: []
35 | * - api_secret: []
36 | *
37 | *
38 | * @see OpenAPI Specification Security
39 | * Requirement Object
40 | **/
41 | @Target({ElementType.METHOD, ElementType.TYPE})
42 | @Retention(RetentionPolicy.RUNTIME)
43 | @Inherited
44 | public @interface SecurityRequirements {
45 | /**
46 | * An array of SecurityRequirement annotations
47 | *
48 | * @return the array of the SecurityRequirement annotations
49 | **/
50 | SecurityRequirement[] value() default {};
51 |
52 | }
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
23 | * {@literal}Override
24 | * public OpenAPI buildModel() {
25 | * return OASFactory.createOpenAPI()
26 | * .addServer(OASFactory.createServer()
27 | * .url("https://{username}.example-server.com:8080/api")
28 | * .description("The production API server")
29 | * .addVariable("username", OASFactory.createServerVariable()
30 | * .defaultValue("user1")
31 | * .description("Reviews of the app by users")
32 | * .addEnumeration("user1")
33 | * .addEnumeration("user2")));
34 | * }
35 | *
36 | */
37 |
38 | @org.osgi.annotation.versioning.Version("2.1")
39 | @org.osgi.annotation.versioning.ProviderType
40 | package org.eclipse.microprofile.openapi.models.servers;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
23 | * .GET(OASFactory.createObject(Operation.class)
24 | * .summary("Retrieve all bookings for current user")
25 | * .operationId("getAllBookings")
26 | * .responses(OASFactory.createObject(APIResponses.class)
27 | * .addApiResponse("200", OASFactory.createObject(APIResponse.class)
28 | * .description("Bookings retrieved")
29 | * .content(OASFactory.createObject(Content.class)
30 | * .addMediaType("applictaion/json", OASFactory.createObject(MediaType.class)
31 | * .schema(OASFactory.createObject(Schema.class)
32 | * .type(Schema.SchemaType.ARRAY)
33 | * .ref("#/components.schemas.Booking")))))
34 | *
35 | */
36 |
37 | @org.osgi.annotation.versioning.Version("2.1")
38 | @org.osgi.annotation.versioning.ProviderType
39 | package org.eclipse.microprofile.openapi.models.responses;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/OASModelReader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
21 | * {@literal @}POST
22 | {@literal @}Callbacks(
23 | {{@literal @}Callback(
24 | name = "testCallback",
25 | callbackUrlExpression="http://localhost:9080/oas3-airlines/reviews",
26 | operations = {@literal @}CallbackOperation(
27 | summary = "Get all reviews",
28 | method = "get",
29 | responses = {@literal @}APIResponse(
30 | responseCode = "200",
31 | description = "successful operation",
32 | content = {@literal @}Content(
33 | mediaType = "application/json",
34 | schema = {@literal @}Schema(
35 | type = SchemaType.ARRAY,
36 | implementation = Review.class
37 | )
38 | )
39 | )
40 | )
41 | )
42 | }
43 | )
44 | *
45 | */
46 |
47 | @org.osgi.annotation.versioning.Version("1.2")
48 | @org.osgi.annotation.versioning.ProviderType
49 | package org.eclipse.microprofile.openapi.annotations.callbacks;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/models/info/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | *
23 | * public class MyOASModelReaderImpl implements OASModelReader {
24 | *
25 | * {@literal @}Override
26 | * public OpenAPI buildModel() {
27 | * return OASFactory.createObject(OpenAPI.class)
28 | * .info(OASFactory.createObject(Info.class)
29 | * .title("AirlinesRatingApp API")
30 | * .version("1.0")
31 | * .termsOfService("http://airlinesratingapp.com/terms")
32 | * .contact(OASFactory.createObject(Contact.class)
33 | * .name("AirlinesRatingApp API Support")
34 | * .url("http://exampleurl.com/contact")
35 | * .email("techsupport{@literal @}airlinesratingapp.com"))
36 | * .license(OASFactory.createObject(License.class)
37 | * .name("Apache 2.0")
38 | * .url("http://www.apache.org/licenses/LICENSE-2.0.html")))
39 | * }
40 | *
41 | */
42 |
43 | @org.osgi.annotation.versioning.Version("1.2")
44 | @org.osgi.annotation.versioning.ProviderType
45 | package org.eclipse.microprofile.openapi.models.info;
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanClassBase.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2019 Contributors to the Eclipse Foundation
3 | *
23 | * public class MyOASModelReaderImpl implements OASModelReader {
24 | *
25 | * {@literal @}Override
26 | * public OpenAPI buildModel() {
27 | * return OASFactory.createObject(OpenAPI.class)
28 | * .info(OASFactory.createObject(Info.class)
29 | * .title("AirlinesRatingApp API")
30 | * .version("1.0")
31 | * .termsOfService("http://airlinesratingapp.com/terms")
32 | * .contact(OASFactory.createObject(Contact.class)
33 | * .name("AirlinesRatingApp API Support")
34 | * .url("http://exampleurl.com/contact")
35 | * .email("techsupport{@literal @}airlinesratingapp.com"))
36 | * .license(OASFactory.createObject(License.class)
37 | * .name("Apache 2.0")
38 | * .url("http://www.apache.org/licenses/LICENSE-2.0.html")))
39 | * }
40 | *
41 | */
42 |
43 | @org.osgi.annotation.versioning.Version("2.2")
44 | @org.osgi.annotation.versioning.ProviderType
45 | package org.eclipse.microprofile.openapi.models;
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *
32 | *
41 | */
42 | public class ConfigAsset implements Asset {
43 |
44 | private Properties properties = new Properties();
45 |
46 | public ConfigAsset put(String key, String... values) {
47 | properties.put(key, String.join(", ", values));
48 | return this;
49 | }
50 |
51 | @Override
52 | public InputStream openStream() {
53 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
54 | try {
55 | properties.store(baos, "Written by ConfigAsset");
56 | } catch (IOException e) {
57 | throw new RuntimeException("Error writing microprofile config properties", e);
58 | }
59 | return new ByteArrayInputStream(baos.toByteArray());
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustWebHookApp.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation
3 | *
33 | * ConfigAsset config = new ConfigAsset()
34 | * .put(OASConfig.SCAN_PACKAGES, "com.example.myPackage")
35 | * .put(OASConfig.SCAN_EXCLUDE_CLASSES, "com.example.myPackage.MyClass");
36 | * WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
37 | * .addPackages(true, "com.example.myPackage")
38 | * .addAsManifestResource(config, "microprofile-config.properties");
39 | *
40 | *
45 | * Example:
46 | * security:
47 | * - oauth_implicit: []
48 | * http_basic: []
49 | * - api_secret: []
50 | *
51 | *
52 | * @see OpenAPI Specification Security
53 | * Requirement Object
54 | **/
55 | @Retention(RUNTIME)
56 | @Target({TYPE, METHOD})
57 | @Inherited
58 | public @interface SecurityRequirementsSets {
59 |
60 | /**
61 | * An array of SecurityRequirementSet annotations
62 | *
63 | * @return the array of the SecurityRequirementSet annotations
64 | **/
65 | SecurityRequirementsSet[] value() default {};
66 | }
67 |
--------------------------------------------------------------------------------
/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017 Contributors to the Eclipse Foundation
3 | * Copyright 2017 SmartBear Software
4 | *