-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #601 from Azquelt/schema-annotation-updates
Schema annotation updates
- Loading branch information
Showing
9 changed files
with
684 additions
and
67 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* <p> | ||
* 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 copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.eclipse.microprofile.openapi.annotations.media; | ||
|
||
/** | ||
* A property name and an associated list of other property names. | ||
* <p> | ||
* Used with {@link Schema#dependentRequired()}, if an object has a property named {@link #name()}, it must also have | ||
* properties with the names in {@link #requires()}. | ||
* | ||
* @see Schema#dependentRequired() | ||
*/ | ||
public @interface DependentRequired { | ||
|
||
/** | ||
* The property name to look for | ||
* | ||
* @return a property name | ||
*/ | ||
String name(); | ||
|
||
/** | ||
* The property names that an object is required to have, if it has a property named {@link #name()} | ||
* | ||
* @return the required property names | ||
*/ | ||
String[] requires(); | ||
} |
41 changes: 41 additions & 0 deletions
41
api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* <p> | ||
* 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 copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.eclipse.microprofile.openapi.annotations.media; | ||
|
||
/** | ||
* A property name and an associated schema. | ||
* <p> | ||
* Used with {@link Schema#dependentSchemas()}, if an instance has a property named {@link #name()}, then it must | ||
* validate against {@link #schema()}. | ||
* | ||
* @see Schema#dependentSchemas() | ||
*/ | ||
public @interface DependentSchema { | ||
|
||
/** | ||
* A property name | ||
* | ||
* @return property name | ||
*/ | ||
String name(); | ||
|
||
/** | ||
* The schema that an instance must validate against if it has a property named {@link #name()}. | ||
* | ||
* @return a class used to generate a schema which is used to validate objects with properties named {@link #name()} | ||
*/ | ||
Class<?> schema(); | ||
} |
47 changes: 47 additions & 0 deletions
47
api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* <p> | ||
* 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 copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.eclipse.microprofile.openapi.annotations.media; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* A regular expression and an associated schema. | ||
* <p> | ||
* Used with {@link Schema#patternProperties()}, properties with names that match {@link #regex()} must have values | ||
* which validate against {@link #schema()}. | ||
* | ||
* @see Schema#patternProperties() | ||
*/ | ||
@Target({}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface PatternProperty { | ||
|
||
/** | ||
* A regular expression to match against property names. | ||
* | ||
* @return an ECMA-262 regular expression | ||
*/ | ||
String regex(); | ||
|
||
/** | ||
* A schema that a property value must validate against | ||
* | ||
* @return a class used to generate a schema used to validate properties with names that match {@link #regex()} | ||
*/ | ||
Class<?> schema(); | ||
} |
Oops, something went wrong.