Class OpenapiContractRegistry
java.lang.Object
ch.nexsol.gateway.validation.OpenapiContractRegistry
Reads the OpenAPI contracts the filter validates against, and keeps each one for as
long as the gateway runs.
Reading and parsing a document blocks, so it happens on the bounded elastic scheduler and only once per location: the first request through a route pays for it, every later one gets the parsed contract straight away. A load that failed is not remembered, so a contract that became reachable again is picked up by the next request rather than needing a restart.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenapiContractRegistry(org.springframework.core.io.ResourceLoader resourceLoader) Creates the registry. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<OpenapiContract> Returns the contract at the given location, reading it on first use.
-
Constructor Details
-
OpenapiContractRegistry
public OpenapiContractRegistry(org.springframework.core.io.ResourceLoader resourceLoader) Creates the registry.- Parameters:
resourceLoader- the loader used to reach a contract that is not addressed by anhttp(s)URL
-
-
Method Details
-
contract
Returns the contract at the given location, reading it on first use.- Parameters:
location- the contract location: anhttp(s)URL, or anything the resource loader understands such asclasspath:orfile:- Returns:
- a mono emitting the parsed contract, failing with
OpenapiContractExceptionwhen it cannot be read
-