Settings
Complete example
app:
port: 2200
homeUrl: /.ui
serviceUrl: /.services
contextUrl: /.contexts
settingsUrl: /.settings
serveUI: true
serveSpec: true
contextAreaPrefix: in-
schemaProvider: libopenapi
createFileStructure: true
editor:
theme: chrome
fontSize: 12
services:
petstore:
latency: 0s
errors:
chance: 0%
codes:
400: 50%
500: 50%
contexts:
- common:
- fake: pet
- fake: gamer
parseConfig:
maxLevels: 6
maxRecursionLevels: 2
validate:
request: true
response: false
cache:
schema: true
Non-configurable values
This document provides a complete list of all configurable settings.
However, there are more values that can be set, but only when using connexions
as library.
app¶
Main application settings.
port¶
Type: number
Default: 2200
homeUrl¶
Default: /.ui
serviceUrl¶
contextUrl¶
settingsUrl¶
serveUi¶
Disable UI if not needed by settings the value to false
.
Default: true
serveSpec¶
Adds swagger-ui to each service.
Default: true
contextAreaPrefix¶
Set sub-contexts for replacements in path, header or any other supported place
in-path:
pet_id: 123
in-header:
x-api-key: abcde
See Contexts documentation for more details.
Default: in-
schemaProvider¶
There're 2 choices:
- libopenapi: view
- kin-openapi: view
Both have their pros and cons.
libopenapi
provides circular reference support, OpenAPI 3.1 support but not widely adopted yet.
kin-openapi
is widely adopted, but doesn't support circular references and OpenAPI 3.1 yet.
But it provides request / response validation.
This setting might be removed in the future.
It is here to provide an easy way to switch between the 2 libraries while picking the right choice.
Default: libopenapi
createFileStructure¶
Pre-create the file structure for the resources.
When set to true
, the file structure will be created on startup:
resources:
|- data:
|- contexts:
|- services
config.yml
Default: true
editor¶
Configuration for UI request / response editor.
theme¶
Default: chrome
For a list of themes, see Ace Editor list.
fontSize¶
Default: 12
services¶
Map of service configurations, where the key
is the service name.
Service name is the first part of the path.
e.g. /petstore/v1/pets -> petstore
In case, service name is omitted, .root
name will be used internally in directory structure.
latency¶
Applies time.Duration
latency to all service responses.
Default: 0s
errors¶
chance¶
Default: 0
codes¶
Map of error codes and their chances.
Default: {}
chance: 25%
codes:
400: 50%
500: 50%
The weights can be specified as int
values as well and don't have to add up to 100.
contexts¶
The name of the context to use when substituting the values in the request/response.
Applied in the order of definition.
See Contexts documentation for more details on working with contexts.
Default:
contexts:
- common:
- fake:
parseConfig¶
Optimize openapi schema parsing for better performance
maxLevels¶
Parse only the first N
levels of the schema
Default: 6
maxRecursionLevels¶
if schema has more than N
levels of recursion, stop parsing
Default: 2
validate¶
Validate incoming requests and outgoing responses to conform to the schema.
Only works with kin-openapi
provider now.
request¶
Default: false
response¶
Default: true
cache¶
Various caching options.
schema¶
Cache the parsed schema in memory for faster access.
Default: true