<% // Test output in playground // https://ionicabizau.github.io/ejs-playground/ // Input variables // const configExtension = 'yml'; // const isSdk = true; // Inline variables const name = 'JavaScript Wiki'; const handler = 'openapi'; const source = 'https://api.apis.guru/v2/specs/wikimedia.org/1.0.0/swagger.yaml'; const browser = false; const selectionSetDepth = 6; if (configExtension === 'cjs' || configExtension ==='js') { -%> module.exports = { sources: [ { name: '<%= name %>', handler: { <%= handler %>: { source: '<%= source %>', }, }, }, ], serve: { browser: <%= browser %>, }, <% if (isSdk) { -%> sdk: { generateOperations: { selectionSetDepth: <%= selectionSetDepth %>, }, }, <% } -%> }; <% } else if (configExtension === 'json') { -%> { "sources": [ { "name": "<%= name %>", "handler": { "<%= handler %>": { "source": "<%= source %>" } } } ], "serve": { "browser": <%= browser %> }<% if (isSdk) { -%>, "sdk": { "generateOperations": { "selectionSetDepth": <%= selectionSetDepth %> } } <% } -%> } <% } else if (configExtension === 'yml') { -%> sources: - name: <%= name %> handler: <%= handler %>: source: <%= source %> serve: browser: false <% if (isSdk) { -%> sdk: generateOperations: selectionSetDepth: <%= selectionSetDepth %> <% } -%> <% }-%>