Skip to content

Commit

Permalink
Add OpenApiValidator feature flag (0.118) (#9785)
Browse files Browse the repository at this point in the history
* Add OpenApiValidator feature flag (#9784)

Signed-off-by: Edwin Greene <[email protected]>
  • Loading branch information
edwin-greene authored Nov 19, 2024
1 parent 96debcc commit 72e1076
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ monitor.
| `hedera.mirror.monitor.nodes[].host` | "" | The main node's hostname |
| `hedera.mirror.monitor.nodes[].port` | 50211 | The main node's port |
| `hedera.mirror.monitor.nodeValidation.enabled` | true | Whether to validate and remove invalid or down nodes permanently before publishing |
| `hedera.mirror.monitor.nodeValidation.frequency` | 1d | The amount of time between validations of the network. If not specified, millisecond is implied as the unit. |
| `hedera.mirror.monitor.nodeValidation.frequency` | 1d | The amount of time between validations of the network. If not specified, millisecond is implied as the unit. |
| `hedera.mirror.monitor.nodeValidation.maxAttempts` | 8 | The number of times the monitor should attempt to receive a healthy response from a node before marking it as unhealthy. |
| `hedera.mirror.monitor.nodeValidation.maxBackoff` | 2s | The maximum amount of time to wait in between attempts when trying to validate a node |
| `hedera.mirror.monitor.nodeValidation.maxThreads` | 25 | The maximum number of threads to use for node validation |
Expand Down Expand Up @@ -503,7 +503,7 @@ The following table lists the available properties along with their default valu
value, it is recommended to only populate overridden properties in the custom `application.yml`.

| Name | Default | Description |
|--------------------------------------------------------------------| ----------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ------------------------------------------------------------------ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hedera.mirror.rest.cache.entityId.maxAge` | 1800 | The number of seconds until the entityId cache entry expires |
| `hedera.mirror.rest.cache.entityId.maxSize` | 100000 | The maximum number of entries in the entityId cache |
| `hedera.mirror.rest.cache.token.maxSize` | 100000 | The maximum number of entries in the token cache |
Expand Down Expand Up @@ -533,6 +533,7 @@ value, it is recommended to only populate overridden properties in the custom `a
| `hedera.mirror.rest.network.unreleasedSupplyAccounts` | [0.0.2, 0.0.42, ...] | An array of account IDs whose aggregated balance subtracted from the total supply is the released supply |
| `hedera.mirror.rest.openapi.specFileName` | 'openapi' | The file name of the OpenAPI spec file |
| `hedera.mirror.rest.openapi.swaggerUIPath` | '/docs' | Swagger UI path for your REST API |
| `hedera.mirror.rest.openapi.validation.enabled` | false | Whether or not the OpenAPI request validation is enabled. |
| `hedera.mirror.rest.port` | 5551 | The REST API port |
| `hedera.mirror.rest.query.bindTimestampRange` | false | Whether to bind the timestamp range to maxTimestampRange |
| `hedera.mirror.rest.query.maxRecordFileCloseInterval` | 10s | The maximum close interval of record files to limit the time partitions to scan. Note the default value is larger than the actual network close interval |
Expand Down
2 changes: 2 additions & 0 deletions hedera-mirror-rest/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ hedera:
openapi:
specFileName: "openapi"
swaggerUIPath: "docs"
validation:
enabled: false
port: 5551
query:
bindTimestampRange: false
Expand Down
5 changes: 4 additions & 1 deletion hedera-mirror-rest/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ global.pool = pool;
const app = addAsync(express());
const {apiPrefix} = constants;
const applicationCacheEnabled = config.cache.response.enabled && config.redis.enabled;
const openApiValidatorEnabled = config.openapi.validation.enabled;

app.disable('x-powered-by');
app.set('trust proxy', true);
app.set('port', port);
app.set('query parser', requestQueryParser);

serveSwaggerDocs(app);
openApiValidator(app);
if (openApiValidatorEnabled || isTestEnv()) {
openApiValidator(app);
}

// middleware functions, Prior to v0.5 define after sets
app.use(
Expand Down

0 comments on commit 72e1076

Please sign in to comment.