Package io.vertx.openapi.contract
Interface OpenAPIContract
-
public interface OpenAPIContract
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Operation
findOperation(String urlPath, HttpMethod method)
Finds the relatedOperation
object based on the passed url path and method.Path
findPath(String urlPath)
Finds the relatedPath
object based on the passed url path.static Future<OpenAPIContract>
from(Vertx vertx, JsonObject unresolvedContract)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.static Future<OpenAPIContract>
from(Vertx vertx, JsonObject unresolvedContract, Map<String,JsonObject> additionalContractFiles)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.static Future<OpenAPIContract>
from(Vertx vertx, String unresolvedContractPath)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.static Future<OpenAPIContract>
from(Vertx vertx, String unresolvedContractPath, Map<String,String> additionalContractFiles)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.List<Path>
getPaths()
JsonObject
getRawContract()
SchemaRepository
getSchemaRepository()
List<SecurityRequirement>
getSecurityRequirements()
Returns the applicable list of global security requirements (scopes) or empty list.List<Server>
getServers()
OpenAPIVersion
getVersion()
Operation
operation(String operationId)
Access to an operation defined in the contract withoperationId
.List<Operation>
operations()
SecurityScheme
securityScheme(String name)
Gets the relatedSecurityScheme
object based on the passed name.
-
-
-
Method Detail
-
from
static Future<OpenAPIContract> from(Vertx vertx, String unresolvedContractPath)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.- Parameters:
vertx
- The related Vert.x instance.unresolvedContractPath
- The path to the unresolved contract.- Returns:
- A succeeded
Future
holding anOpenAPIContract
instance, otherwise a failedFuture
.
-
from
static Future<OpenAPIContract> from(Vertx vertx, JsonObject unresolvedContract)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.- Parameters:
vertx
- The related Vert.x instance.unresolvedContract
- The unresolved contract.- Returns:
- A succeeded
Future
holding anOpenAPIContract
instance, otherwise a failedFuture
.
-
from
static Future<OpenAPIContract> from(Vertx vertx, String unresolvedContractPath, Map<String,String> additionalContractFiles)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.This method can be used in case that the contract is split into several files. These files can be passed in a Map that has the reference as key and the path to the file as value.
- Parameters:
vertx
- The related Vert.x instance.unresolvedContractPath
- The path to the unresolved contract.additionalContractFiles
- The additional contract files- Returns:
- A succeeded
Future
holding anOpenAPIContract
instance, otherwise a failedFuture
.
-
from
static Future<OpenAPIContract> from(Vertx vertx, JsonObject unresolvedContract, Map<String,JsonObject> additionalContractFiles)
Resolves / dereferences the passed contract and creates anOpenAPIContract
instance.This method can be used in case that the contract is split into several files. These files can be passed in a Map that has the reference as key and the path to the file as value.
- Parameters:
vertx
- The related Vert.x instance.unresolvedContract
- The unresolved contract.additionalContractFiles
- The additional contract files- Returns:
- A succeeded
Future
holding anOpenAPIContract
instance, otherwise a failedFuture
.
-
operation
Operation operation(String operationId)
Access to an operation defined in the contract withoperationId
.- Parameters:
operationId
- the id of the operation.- Returns:
- the requested operation.
- Throws:
IllegalArgumentException
- if the operation id doesn't exist in the contract.
-
getRawContract
JsonObject getRawContract()
- Returns:
- the resolved OpenAPI contract as
JsonObject
.
-
getVersion
OpenAPIVersion getVersion()
- Returns:
- the OpenAPI version of the contract.
-
getSchemaRepository
SchemaRepository getSchemaRepository()
- Returns:
- the
SchemaRepository
to validate against.
-
findOperation
Operation findOperation(String urlPath, HttpMethod method)
Finds the relatedOperation
object based on the passed url path and method.
-
getSecurityRequirements
List<SecurityRequirement> getSecurityRequirements()
Returns the applicable list of global security requirements (scopes) or empty list.- Returns:
- The related security requirement.
-
securityScheme
SecurityScheme securityScheme(String name)
Gets the relatedSecurityScheme
object based on the passed name.- Parameters:
name
- The name of the security scheme.- Returns:
- the found
SecurityScheme
object, or null if the passed path and method doesn't match anyOperation
object.
-
-