luckymarmot/API-Flow

Core - Config - Configuration files for API-Flow

Opened this issue · 1 comments

API-Flow should support configuration files to give users a finer control on the behavior of the tool.

Here are some of the options which could be useful:

Parsers

General
  • name: [swagger]: the name of the parser (e.g. swagger, raml, postman, curl, etc.). Default is swagger.
  • instance: [null] if name is custom, an instance field could be used to pass a custom parser
Swagger
  • no-x: [false]. If this option is set to true, the parser will not attempt to parse x-* patterned fields that it recognizes
  • version: [2.0]. Not supported in v0.1. In the future, changing this option will allow user to parse v1.2 swagger files. If set to auto, the parser will attempt to guess which version is the most suited.
RAML
  • warn-on-missing: [no-warn]. The level at which missing files raise warnings for the user. It can be any of [group, request, parameter, schema, example, none]
Postman:
  • flatten: [null]. If flatten is set to a number, it will represent the maximum depth of nested references that are supported before resolution. e.g. if flatten: 1 the following reference user{{{{domain}}-userId}} will be flattened to user{{production-userId}}. set flatten to 0 to resolve immediately.
Curl:
  • bash: [inline]. Not supported in v0.1. Search for bash environment variables.
  • speech-marks: [false]. If set to true, the parser will try to parse unicode speech marks as regular speech marks potentially delimiting keywords.
  • 'strip-newlines: [false]'. when encountering a curl command, strips out new lines from the input arguments if set to true.

Resolver

General
  • name: [web]: the name of the resolver (e.g. node, web, paw, atom, etc.)
  • instance: [null]. If name is custom, an instance field could be used to pass a custom resolver
  • cwd: [.]. Not supported in v0.1. the directory/url from which to resolve all the uris.
  • resolve: [true]. resolve accepts either a boolean, an object, or an array, which define how the granularity of the resolution.
Resolve parameter:
  • [true/false]. if set to false, no resolution is done. if set to true, the resolver will try to resolve as much as possible.
  • [object]: the object should be of the following form:
{
    remote: [true/false],
    local: [true/false],
    custom: [array]
}
  • [array], is equivalent to [object] with remote and local set to true, and custom set to [array]. The array should respect the following form:
[
    {
         relative: '#/some/relative/uri',
         resolve: [true/false],
         value: [null/*]
    },
    ...
]

Serializers

General
  • name: [web]: the name of the serializer (e.g. postman, raml, swagger, curl, etc.)
  • instance: [null]. If name is custom, an instance field could be used to pass a custom serializer
  • obfuscate: [false]. if set to true, the serializer will try to obfuscate commonly used authentication fields, such as user, username, password, secret, etc.
Swagger:
  • no-x: [false] if set to true, drops all x-* patterned fields that provide additional informations created by API-Flow.
  • format: [json]. alternative value is yaml
Paw
  • domain: [null], if domain is set, use that name instead of the ones from API-Flow as a domain name.
Postman
  • environment: [API-Flow]. if environment is set, use that name instead of the ones from API-Flow as an environment name.
curl
  • no-comments: [false]. if set to true, output will have no comments to help readability.
  • no-vars: [false]. if set to true, output will have no environment variables.

There are probably other options that could be added.

Partial Implementation in PR #45. Good enough for v0.1