Package io.vertx.json.schema
Enum Draft
- java.lang.Object
-
- java.lang.Enum<Draft>
-
- io.vertx.json.schema.Draft
-
- All Implemented Interfaces:
Serializable
,Comparable<Draft>
public enum Draft extends Enum<Draft>
Json-Schema drafts. The enum does not explicitly define all known drafts but a selection of the most widely used ones and supported in the implementation.- Author:
- Paulo Lopes
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DRAFT201909
Draft 2019-09 - https://json-schema.org/draft/2019-09/schema Commonly used by many projectsDRAFT202012
Draft 2020-12 - https://json-schema.org/draft/2020-12/schema Usually used by OpenAPI 3.1DRAFT4
Draft 4 - http://json-schema.org/draft-04/schema# Usually used by OpenAPI 3.0DRAFT7
Draft 7 - http://json-schema.org/draft-07/schema# Commonly used by many projects
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Draft
from(String string)
Converts a draft number to aDraft
enum value.static Draft
fromIdentifier(String string)
Converts a draft identifier to aDraft
enum value.String
getIdentifier()
boolean
isAfter(Draft draft)
boolean
isBefore(Draft draft)
static Draft
valueOf(String name)
Returns the enum constant of this type with the specified name.static Draft[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DRAFT4
public static final Draft DRAFT4
Draft 4 - http://json-schema.org/draft-04/schema# Usually used by OpenAPI 3.0
-
DRAFT7
public static final Draft DRAFT7
Draft 7 - http://json-schema.org/draft-07/schema# Commonly used by many projects
-
DRAFT201909
public static final Draft DRAFT201909
Draft 2019-09 - https://json-schema.org/draft/2019-09/schema Commonly used by many projects
-
DRAFT202012
public static final Draft DRAFT202012
Draft 2020-12 - https://json-schema.org/draft/2020-12/schema Usually used by OpenAPI 3.1
-
-
Method Detail
-
values
public static Draft[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Draft c : Draft.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Draft valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getIdentifier
public String getIdentifier()
- Returns:
- the identifier of the draft version.
-
from
public static Draft from(String string)
Converts a draft number to aDraft
enum value.- Parameters:
string
- A draft number, e.g.:[4|7|8|2019-09|2020-12]
- Returns:
- a Draft enum value
-
fromIdentifier
public static Draft fromIdentifier(String string)
Converts a draft identifier to aDraft
enum value.- Parameters:
string
- The identifier (in URL format)- Returns:
- a Draft enum value
-
isAfter
public boolean isAfter(Draft draft)
- Parameters:
draft
- to check against- Returns:
- true if the draft instance was released after the draft provided.
-
isBefore
public boolean isBefore(Draft draft)
- Parameters:
draft
- to check against- Returns:
- true if the draft instance was released before the draft provided.
-
-