Interface OpenAPIContract


public interface OpenAPIContract
  • Method Details

    • builder

      static OpenAPIContractBuilder builder(Vertx vertx)
      Instantiates a new builder for an openapi-contract.
      Parameters:
      vertx - The vert.x instance
      Returns:
      A new builder.
    • from

      static Future<OpenAPIContract> from(Vertx vertx, String contractPath)
      Resolves / dereferences the passed contract and creates an OpenAPIContract instance.
      Parameters:
      vertx - The related Vert.x instance.
      contractPath - The path to the contract.
      Returns:
      A succeeded Future holding an OpenAPIContract instance, otherwise a failed Future.
    • from

      static Future<OpenAPIContract> from(Vertx vertx, JsonObject contract)
      Resolves / dereferences the passed contract and creates an OpenAPIContract instance.
      Parameters:
      vertx - The related Vert.x instance.
      contract - The contract.
      Returns:
      A succeeded Future holding an OpenAPIContract instance, otherwise a failed Future.
    • from

      static Future<OpenAPIContract> from(Vertx vertx, String contractPath, Map<String,String> additionalContractPartPaths)
      Resolves / dereferences the passed contract and creates an OpenAPIContract instance.

      This method can be used in case that the contract is split into several parts. These parts can be passed in a Map that has the reference as key and the path to the part as value.

      Parameters:
      vertx - The related Vert.x instance.
      contractPath - The path to the contract.
      additionalContractPartPaths - The additional contract part paths
      Returns:
      A succeeded Future holding an OpenAPIContract instance, otherwise a failed Future.
    • from

      static Future<OpenAPIContract> from(Vertx vertx, JsonObject contract, Map<String, JsonObject> additionalContractParts)
      Resolves / dereferences the passed contract and creates an OpenAPIContract instance.

      This method can be used in case that the contract is split into several parts. These parts can be passed in a Map that has the reference as key and the part as value.

      Parameters:
      vertx - The related Vert.x instance.
      contract - The unresolved contract.
      additionalContractParts - The additional contract parts
      Returns:
      A succeeded Future holding an OpenAPIContract instance, otherwise a failed Future.
    • operation

      Operation operation(String operationId)
      Access to an operation defined in the contract with operationId.
      Parameters:
      operationId - the id of the operation.
      Returns:
      the requested operation.
      Throws:
      IllegalArgumentException - if the operation id doesn't exist in the contract.
    • operations

      List<Operation> operations()
      Returns:
      all operations defined in the contract.
    • getPaths

      List<Path> getPaths()
      Returns:
      all Paths defined in the OpenAPI 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.
    • getServers

      List<Server> getServers()
      Returns:
      the servers of the contract.
    • findPath

      Path findPath(String urlPath)
      Finds the related Path object based on the passed url path.
      Parameters:
      urlPath - The path of the request.
      Returns:
      the found Path object, or null if the passed path doesn't match any Path object.
    • findOperation

      Operation findOperation(String urlPath, HttpMethod method)
      Finds the related Operation object based on the passed url path and method.
      Parameters:
      urlPath - The path of the request.
      method - The method of the request.
      Returns:
      the found Operation object, or null if the passed path and method doesn't match any Operation object.
    • 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 related SecurityScheme 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 any Operation object.