UNPKG

saasify-openapi-utils

Version:
1,535 lines (1,496 loc) 181 kB
# Snapshot report for `lib/parse-openapi.test.js` The actual snapshot is saved in `parse-openapi.test.js.snap`. Generated by [AVA](https://avajs.dev). ## parseOpenAPI error google-webfonts-swagger-2 > Snapshot 1 'Invalid OpenAPI spec must provide "openapi" version' ## parseOpenAPI error invalid-path > Snapshot 1 'Invalid path "foo" must start with "/"' ## parseOpenAPI success basic > Snapshot 1 { info: { title: 'Fast API', version: '0.1.0', }, openapi: '3.0.2', paths: { '/': { get: { operationId: 'read_root__get', parameters: [ { in: 'query', name: 'q', required: false, schema: { title: 'Q', type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { schema: {}, }, }, description: 'Successful Response', }, }, summary: 'Read Root', }, }, }, } ## parseOpenAPI success examples-get-params-0 > Snapshot 1 { info: { description: 'Should output an object with default values from get.parameters', title: 'Fixture Examples', version: '0.1.0', }, openapi: '3.0.2', paths: { '/': { get: { parameters: [ { in: 'query', name: 'foo', required: true, schema: { example: 'foo', title: 'foo', type: 'string', }, }, { example: 'bar', in: 'query', name: 'bar', schema: { title: 'bar', type: 'string', }, }, { examples: { foo: { value: 'baz0', }, }, in: 'query', name: 'baz0', schema: { title: 'baz0', type: 'string', }, }, { examples: [ 'baz1', ], in: 'query', name: 'baz1', schema: { title: 'baz1', type: 'string', }, }, { in: 'query', name: 'abc0', schema: { examples: { foo: { value: 'abc0', }, }, title: 'abc0', type: 'string', }, }, { in: 'query', name: 'abc1', schema: { examples: [ 'abc1', ], title: 'abc1', type: 'string', }, }, { in: 'query', name: 'nala', schema: { default: 13, title: 'nala', type: 'number', }, }, { in: 'query', name: 'blank', schema: { description: 'shouldn\'t show up in examples', title: 'blank', type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { schema: {}, }, }, description: 'Successful Response', }, }, }, }, }, } ## parseOpenAPI success examples-get-params-1 > Snapshot 1 { info: { description: 'Should output an object with default values from get.parameters and op.parameters', title: 'Fixture Examples', version: '0.1.0', }, openapi: '3.0.2', paths: { '/': { get: { parameters: [ { examples: { foo: { value: 'baz0', }, }, in: 'query', name: 'baz0', schema: { title: 'baz0', type: 'string', }, }, { examples: [ 'baz1', ], in: 'query', name: 'baz1', schema: { title: 'baz1', type: 'string', }, }, { in: 'query', name: 'abc0', schema: { examples: { foo: { value: 'abc0', }, }, title: 'abc0', type: 'string', }, }, { in: 'query', name: 'abc1', schema: { examples: [ 'abc1', ], title: 'abc1', type: 'string', }, }, { in: 'query', name: 'nala', schema: { default: 13, title: 'nala', type: 'number', }, }, { in: 'query', name: 'blank', schema: { description: 'shouldn\'t show up in examples', title: 'blank', type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { schema: {}, }, }, description: 'Successful Response', }, }, }, parameters: [ { in: 'query', name: 'foo', required: true, schema: { example: 'foo', title: 'foo', type: 'string', }, }, { example: 'bar', in: 'query', name: 'bar', schema: { title: 'bar', type: 'string', }, }, ], }, }, } ## parseOpenAPI success examples-get-params-2 > Snapshot 1 { info: { description: 'Missing required parameter baz0 so should output []', title: 'Fixture Examples', version: '0.1.0', }, openapi: '3.0.2', paths: { '/': { get: { parameters: [ { in: 'query', name: 'baz0', required: true, schema: { title: 'baz0', type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { schema: {}, }, }, description: 'Successful Response', }, }, }, parameters: [ { in: 'query', name: 'foo', required: true, schema: { example: 'foo', title: 'foo', type: 'string', }, }, { example: 'bar', in: 'query', name: 'bar', schema: { title: 'bar', type: 'string', }, }, ], }, }, } ## parseOpenAPI success examples-post-request-body-0 > Snapshot 1 { info: { description: 'Should output an example list of ingredients', title: 'Zestful', version: '0.1.0', }, openapi: '3.0.2', paths: { '/parseIngredients': { post: { description: 'Parses a list of raw ingredient strings into structured JSON.', requestBody: { content: { 'application/json': { example: { ingredients: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], }, schema: { additionalProperties: false, properties: { ingredients: { description: `List of ingredients to parse.␊ - This list must contain between 1 and 100 elements.␊ - Each string in the list must be 1,024 characters or fewer.␊ - Unicode strings are supported.␊ - The strings may be HTML- or URL-encoded.␊ - Any HTML tags in the ingredient strings will be ignored.`, items: { type: 'string', }, title: 'ingredients', type: 'array', }, }, required: [ 'ingredients', ], type: 'object', }, }, }, }, summary: 'Parse Ingredients', }, }, }, } ## parseOpenAPI success examples-post-request-body-1 > Snapshot 1 { info: { description: 'Should output an example list of ingredients (aggregated)', title: 'Zestful', version: '0.1.0', }, openapi: '3.0.2', paths: { '/parseIngredients': { post: { description: 'Parses a list of raw ingredient strings into structured JSON.', requestBody: { content: { 'application/json': { schema: { additionalProperties: false, example: { ingredients: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], }, properties: { ingredients: { description: `List of ingredients to parse.␊ - This list must contain between 1 and 100 elements.␊ - Each string in the list must be 1,024 characters or fewer.␊ - Unicode strings are supported.␊ - The strings may be HTML- or URL-encoded.␊ - Any HTML tags in the ingredient strings will be ignored.`, items: { type: 'string', }, title: 'ingredients', type: 'array', }, }, required: [ 'ingredients', ], type: 'object', }, }, }, }, summary: 'Parse Ingredients', }, }, }, } ## parseOpenAPI success examples-post-request-body-2 > Snapshot 1 { info: { description: 'Should output an example list of ingredients (aggregated)', title: 'Zestful', version: '0.1.0', }, openapi: '3.0.2', paths: { '/parseIngredients': { post: { description: 'Parses a list of raw ingredient strings into structured JSON.', requestBody: { content: { 'application/json': { schema: { additionalProperties: false, properties: { ingredients: { description: `List of ingredients to parse.␊ - This list must contain between 1 and 100 elements.␊ - Each string in the list must be 1,024 characters or fewer.␊ - Unicode strings are supported.␊ - The strings may be HTML- or URL-encoded.␊ - Any HTML tags in the ingredient strings will be ignored.`, example: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], items: { type: 'string', }, title: 'ingredients', type: 'array', }, }, required: [ 'ingredients', ], type: 'object', }, }, }, }, summary: 'Parse Ingredients', }, }, }, } ## parseOpenAPI success examples-post-request-body-3 > Snapshot 1 { info: { description: 'Should output an example list of ingredients (aggregated, deduped)', title: 'Zestful', version: '0.1.0', }, openapi: '3.0.2', paths: { '/parseIngredients': { post: { description: 'Parses a list of raw ingredient strings into structured JSON.', requestBody: { content: { 'application/json': { example: { ingredients: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], }, schema: { additionalProperties: false, properties: { ingredients: { description: `List of ingredients to parse.␊ - This list must contain between 1 and 100 elements.␊ - Each string in the list must be 1,024 characters or fewer.␊ - Unicode strings are supported.␊ - The strings may be HTML- or URL-encoded.␊ - Any HTML tags in the ingredient strings will be ignored.`, example: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], items: { type: 'string', }, title: 'ingredients', type: 'array', }, }, required: [ 'ingredients', ], type: 'object', }, }, }, }, summary: 'Parse Ingredients', }, }, }, } ## parseOpenAPI success examples-post-request-body-4 > Snapshot 1 { info: { description: 'Should output an example list of ingredients (aggregated, unique). Should have two examples as output', title: 'Zestful', version: '0.1.0', }, openapi: '3.0.2', paths: { '/parseIngredients': { post: { description: 'Parses a list of raw ingredient strings into structured JSON.', requestBody: { content: { 'application/json': { example: { ingredients: [ '2 tall apples', '1 tiny kitten', '½ tsp brown sugar', ], }, schema: { additionalProperties: false, properties: { ingredients: { description: `List of ingredients to parse.␊ - This list must contain between 1 and 100 elements.␊ - Each string in the list must be 1,024 characters or fewer.␊ - Unicode strings are supported.␊ - The strings may be HTML- or URL-encoded.␊ - Any HTML tags in the ingredient strings will be ignored.`, example: [ '3 large Granny Smith apples', '2 1/2 tablespoons finely chopped parsley', '½ tsp brown sugar', ], items: { type: 'string', }, title: 'ingredients', type: 'array', }, }, required: [ 'ingredients', ], type: 'object', }, }, }, }, summary: 'Parse Ingredients', }, }, }, } ## parseOpenAPI success icons8 > Snapshot 1 { components: { requestBodies: { Body: { content: { 'application/json': { schema: { example: { auth: { hash: 'api-demo-user', }, task: { arguments: { collection: 'bef787ce-41ad-4424-8e0e-19ce78e104c3', css_prefix: 'icons8', css_rules_case: 'lowercase', css_selector: '.icons8-{{glyph}}', font_name: 'Material Very Basic', }, }, }, properties: { auth: { properties: { hash: { description: 'Authorization hash', type: 'string', }, }, required: [ 'hash', ], type: 'object', }, task: { properties: { arguments: { properties: { collection: { description: 'collection identifier', type: 'string', }, css_prefix: { default: 'icons8', description: 'prefix for CSS rules, used to generate LESS/SCSS', type: 'string', }, css_rules_case: { default: 'lowercase', description: 'glyph names conversion rule', enum: [ 'lowercase', 'as_is', ], type: 'string', }, css_selector: { default: '.icons8-{{glyph}}', description: 'template for glyph selector; placeholder {{glyph}} will be replaced with glyph names', type: 'string', }, font_name: { default: 'font_icons8', description: 'name of iconic webfont', type: 'string', }, }, required: [ 'collection', 'font_name', ], type: 'object', }, }, type: 'object', }, }, type: 'object', }, }, }, }, }, schemas: { AuthArgument: { properties: { hash: { description: 'Authorization hash', type: 'string', }, }, required: [ 'hash', ], type: 'object', }, CategoryV3Item: { properties: { category_code: { type: 'string', }, category_name: { type: 'string', }, subcategory: { items: {}, type: 'array', }, }, type: 'object', }, CollectionWebFontTaskArguments: { properties: { arguments: { properties: { collection: { description: 'collection identifier', type: 'string', }, css_prefix: { description: 'prefix for CSS rules, used to generate LESS/SCSS', type: 'string', }, css_rules_case: { description: 'glyph names conversion rule', enum: [ 'lowercase', 'as_is', ], type: 'string', }, css_selector: { description: 'template for glyph selector; placeholder {{glyph}} will be replaced with glyph names', type: 'string', }, font_name: { description: 'name of iconic webfont', type: 'string', }, }, required: [ 'collection', 'font_name', ], type: 'object', }, }, type: 'object', }, CompactCategoryV3Item: { properties: { api_code: { type: 'string', }, name: { type: 'string', }, }, required: [ 'name', 'api_code', ], type: 'object', }, CompactIconV3Item: { properties: { category: { type: 'string', }, common_icon_id: { description: 'identifier for group of the same icons in different styles; i.e. id of all "home" icons', type: 'number', }, created: { description: 'date (ISO8601 format) of icon was published', type: 'string', }, features: { description: 'internal service attribute; internal information about icon features; private; depend on the rights of the current user', properties: { bitmap: { description: '"Could user use images in bitmap / raster formats in any size ?"', type: 'number', }, nolink: { description: '"Could user use images without any link to Icons8 ?"', type: 'number', }, vector: { description: '"Could user use images in vector formats ?"', type: 'number', }, }, required: [ 'bitmap', 'vector', 'nolink', ], type: 'object', }, id: { description: 'unique icon identifier', type: 'number', }, name: { description: 'icon name', type: 'string', }, platform_code: { description: 'icon style', type: 'string', }, share: { description: 'internal service attribute; some links to spread the world', properties: { png: { description: 'some raster images for share the icon', items: {}, type: 'array', }, url: { description: 'short URL to use in twitter', type: 'string', }, }, type: 'object', }, subcategory: { properties: { api_code: { type: 'string', }, name: { type: 'string', }, }, required: [ 'name', 'api_code', ], type: 'object', }, svg: { description: 'plain SVG content of icon', type: 'string', }, url: { description: 'internal service attribute; the meaning of this attribute is "Identifier of thread at Disquss"', type: 'string', }, vector: { description: 'URLs to icon sources in different vector formats; private; depend on the current user and could be opened in user\'s browser only', properties: { eps: { description: 'absolute URL to file in EPS format', type: 'string', }, pdf: { description: 'absolute URL to file in PDF format', type: 'string', }, 'svg-editable': { description: 'absolute URL to original SVG file', type: 'string', }, 'svg-simplified': { description: 'absolute URL to compressed and simplified SVG file', type: 'string', }, }, type: 'object', }, }, required: [ 'id', 'name', 'platform_code', 'created', 'common_icon_id', 'svg', 'features', ], type: 'object', }, IconV3Item: { allOf: [ { $ref: '#/components/schemas/CompactIconV3Item', }, { properties: { category: { type: 'string', }, common_icon_id: { description: 'identifier for group of the same icons in different styles; i.e. id of all "home" icons', type: 'number', }, created: { description: 'date (ISO8601 format) of icon was published', type: 'string', }, features: { description: 'internal service attribute; internal information about icon features; private; depend on the rights of the current user', properties: { bitmap: { description: '"Could user use images in bitmap / raster formats in any size ?"', type: 'number', }, nolink: { description: '"Could user use images without any link to Icons8 ?"', type: 'number', }, vector: { description: '"Could user use images in vector formats ?"', type: 'number', }, }, required: [ 'bitmap', 'vector', 'nolink', ], type: 'object', }, id: { description: 'unique icon identifier', type: 'number', }, name: { description: 'icon name', type: 'string', }, platform_code: { description: 'icon style', type: 'string', }, share: { description: 'internal service attribute; some links to spread the world', properties: { png: { description: 'some raster images for share the icon', items: {}, type: 'array', }, url: { description: 'short URL to use in twitter', type: 'string', }, }, type: 'object', }, subcategory: { properties: { api_code: { type: 'string', }, name: { type: 'string', }, }, required: [ 'name', 'api_code', ], type: 'object', }, svg: { description: 'plain SVG content of icon', type: 'string', }, url: { description: 'internal service attribute; the meaning of this attribute is "Identifier of thread at Disquss"', type: 'string', }, vector: { description: 'URLs to icon sources in different vector formats; private; depend on the current user and could be opened in user\'s browser only', properties: { eps: { description: 'absolute URL to file in EPS format', type: 'string', }, pdf: { description: 'absolute URL to file in PDF format', type: 'string', }, 'svg-editable': { description: 'absolute URL to original SVG file', type: 'string', }, 'svg-simplified': { description: 'absolute URL to compressed and simplified SVG file', type: 'string', }, }, type: 'object', }, }, required: [ 'id', 'name', 'platform_code', 'created', 'common_icon_id', 'svg', 'features', ], type: 'object', }, ], }, Meta: {}, Search: {}, TaskError: { properties: { code: { description: 'error code', enum: [ 'json_not_valid', 'auth_required', 'auth_failed', 'access_denied', 'io_fail', 'database_fail', 'argument_is_missed', 'argument_is_wrong', 'paid_feature', 'not_possible', ], type: 'string', }, description: { description: 'human readable error message', type: 'string', }, }, required: [ 'code', 'description', ], type: 'object', }, TaskResult: { properties: { description: { description: 'human readable description', type: 'string', }, id: { description: 'task identifier', type: 'string', }, results: { properties: { zip: { description: 'URL to webfont files in ZIP format', type: 'string', }, }, type: 'object', }, status: { description: 'task status', enum: [ '`preparing+', 'idle', 'in_progress', 'timeout', 'complete', 'failed', ], type: 'string', }, type: { description: 'task type', enum: [ 'create_web_font', 'create_svg_set', ], type: 'string', }, }, required: [ 'id', 'type', 'status', ], type: 'object', }, TotalV3Item: { properties: { api_code: { description: 'icons style code; in other places it named `plarform` or `platform_api_code`', enum: [ 'ios7', 'win8', 'win10', 'android', 'androidL', 'color', 'office', ], type: 'string', }, name: { type: 'string', }, total: { type: 'number', }, }, required: [ 'name', 'api_code', 'total', ], type: 'object', }, Web_Fonts: {}, }, }, info: { description: `# Icons8 API␊ ␊ Icons8 API allows us to search and obtain [our icons](https://icons8.com/web-app).␊ ␊ You're welcome to use our icons to extend the functionality of your web and mobile applications, website templates, and even tattoos.␊ ␊ ![Tattoos](https://cdn.rawgit.com/icons8/api-docs/cff6fdf0/tattoos.svg)␊ ␊ ## Usage Examples␊ ␊ Some examples of what you can do with our icons:␊ ␊ * **Template customization.** This way, [Canva](https://www.canva.com/) uses our icons to customize their layouts.␊ ␊ * **Graphics and text editors.** [Gravit](https://gravit.io/) allows to insert our icons into the mockups.␊ ␊ * **Any application with customization.** [TimeTune](http://timetune.center/) uses our icons to customize the activities.␊ ␊ ## Getting Started␊ ␊ To get started, please [contact us](https://icons8.com/contact) to obtain an API key.␊ ␊ ## Pricing␊ ␊ Our API license starts at $100/month.`, title: 'Use a [New Version](https://icons8.github.io/icons8-docs/) Instead', version: '1.0.0', 'x-apisguru-categories': [ 'media', ], 'x-logo': { url: 'https://twitter.com/icons_8/profile_image?size=original', }, 'x-origin': [ { converter: { url: 'https://github.com/lucybot/api-spec-converter', version: '2.7.31', }, format: 'apiBlueprint', url: 'https://raw.githubusercontent.com/icons8/api-docs/master/apiary.apib', version: '1A', }, ], 'x-providerName': 'icons8.com', }, openapi: '3.0.0', paths: { '/api/iconsets/v3/categories?platform={platform}&language={language}': { get: { description: `The operation will not return the categories that have less than 10 icons.␊ We need it to test the categories without showing garbage on the production website.`, parameters: [ { description: 'the platform that we are searching icons for', in: 'path', name: 'platform', required: true, schema: { enum: [ 'ios7', 'win8', 'win10', 'android', 'androidL', 'color', 'office', ], type: 'string', }, }, { description: 'the language code to get localized result', example: 'en-US', in: 'path', name: 'language', required: true, schema: { enum: [ 'en-US', 'fr-FR', 'de-DE', 'it-IT', 'pt-BR', 'pl-PL', 'ru-RU', 'es-ES', ], type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { examples: { response: { value: { parameters: { language: '', platform: '', }, result: { categories: [ { category_code: '', category_name: '', subcategory: [ { icons: [ { common_icon_id: 0, created: '', features: { bitmap: 0, nolink: 0, vector: 0, }, id: 0, name: '', platform_code: '', svg: '', url: '', }, ], subcategory_code: '', subcategory_name: '', }, ], }, { api_code: 'Alphabet', category_code: '', category_name: '', name: 'Alphabet', subcategory: [ { icons: [ { common_icon_id: 0, created: '', features: { bitmap: 0, nolink: 0, vector: 0, }, id: 0, name: '', platform_code: '', svg: '', url: '', }, ], subcategory_code: '', subcategory_name: '', }, ], }, { api_code: 'Very_Basic', category_code: '', category_name: '', name: 'Very Basic', subcategory: [ { icons: [ { common_icon_id: 0, created: '', features: { bitmap: 0, nolink: 0, vector: 0, }, id: 0, name: '', platform_code: '', svg: '', url: '', }, ], subcategory_code: '', subcategory_name: '', }, ], }, { api_code: 'Photo_Video', category_code: '', category_name: '', name: 'Photo and Video', subcategory: [ { icons: [ { common_icon_id: 0, created: '', features: { bitmap: 0, nolink: 0, vector: 0, }, id: 0, name: '', platform_code: '', svg: '', url: '', }, ], subcategory_code: '', subcategory_name: '', }, ], }, ], }, }, }, }, schema: { properties: { parameters: { description: 'copy of the input parameters from the request', properties: { language: { type: 'string', }, platform: { type: 'string', }, }, type: 'object', }, result: { description: 'the result of operation', properties: { categories: { items: {}, type: 'array', }, }, type: 'object', }, }, type: 'object', }, }, }, description: 'OK', headers: {}, }, }, summary: 'Categories', tags: [], }, }, '/api/iconsets/v3/category?category={category}&subcategory={subcategory}&amount={amount}&offset={offset}&platform={platform}&language={language}': { get: { description: '', parameters: [ { description: 'the code of category', example: 'free_icons', in: 'path', name: 'category', required: true, schema: { type: 'string', }, }, { description: 'the code of subcategory', example: 'home_appliances', in: 'path', name: 'subcategory', required: true, schema: { type: 'string', }, }, { description: 'the maximum number of icons which you\'d like to receive', in: 'path', name: 'amount', required: true, schema: { default: 25, type: 'number', }, }, { description: 'the offset from the first received result', in: 'path', name: 'offset', required: true, schema: { type: 'number', }, }, { description: 'the style of the icons', in: 'path', name: 'platform', required: true, schema: { enum: [ 'ios7', 'win8', 'win10', 'android', 'androidL', 'color', 'office', ], type: 'string', }, }, { description: 'the language code to get localized result', example: 'en-US', in: 'path', name: 'language', required: true, schema: { enum: [ 'en-US', 'fr-FR', 'de-DE', 'it-IT', 'pt-BR', 'pl-PL', 'ru-RU', 'es-ES', ], type: 'string', }, }, ], responses: { 200: { content: { 'application/json': { examples: { response: { value: { parameters: { amount: 0, category: '', language: '', offset: '', platform: '', subcategory: '', }, result: { category: [ { category_code: '', category_name: '', subcategory: [ { icons: [ { common_icon_id: 0, created: '', features: {