From 601c6060a4e6a889e3c5a72c2b26ea3e2d479a66 Mon Sep 17 00:00:00 2001 From: Opender Singh Date: Wed, 30 Sep 2020 19:38:44 +1300 Subject: [PATCH] Update o2k readme examples (#2679) --- packages/openapi-2-kong/README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/openapi-2-kong/README.md b/packages/openapi-2-kong/README.md index a1498dd6b..ac409329a 100644 --- a/packages/openapi-2-kong/README.md +++ b/packages/openapi-2-kong/README.md @@ -54,20 +54,23 @@ paths: `; async function examples() { + const tags = [ 'MyTag' ]; + const type = 'kong-declarative-config'; // or 'kong-for-kubernetes' + // Generate a config from YAML string - const config1 = await o2k.generateFromString(spec, [ 'MyTag' ]); + const config1 = await o2k.generateFromString(spec, type, tags); // Generate a config from a JS object const specObject = require('yaml').parse(spec); - const config2 = await o2k.generateFromSpec(specObject, [ 'MyTag' ]); + const config2 = await o2k.generateFromSpec(specObject, type, tags); // Generate a config from a JSON string const specJSON = JSON.stringify(specObject); - const config3 = await o2k.generateFromString(specJSON, [ 'MyTag' ]); + const config3 = await o2k.generateFromString(specJSON, type, tags); // generate a config from a file path require('fs').writeFileSync('/tmp/spec.yaml', spec); - const config4 = await o2k.generate('/tmp/spec.yaml', [ 'MyTag' ]); + const config4 = await o2k.generate('/tmp/spec.yaml', type, tags); console.log('Generated:', { config1, config2, config3, config4 }); }