[Bug] OpenAPI import does not seem to honor default variables in servers declaration
See original GitHub issue- Insomnia Version: 6.6.2
- Operating System: MacOS mojave 10.14.6
Details
I’m trying to import an OpenAPI 3 spec that uses variables in the server url. Default values are provided for these in the variables declaration. This results in an error when i try to import the file: Invalid URL: http://{host}:{port}/{basePath}
If I replace the url with the following string it works: http://localhost:8080/filemanagement
OpenAPI yaml file (parts of it - but it can be used to reproduce the bug and import works after replacing the servers/url part):
openapi: 3.0.2
info:
description: OpenAPI definition for filemanagment services
license:
name: todo
url: todo
title: filemanagement
version: 0.1.0
servers:
- description: Devserver
url: http://{host}:{port}/{basePath}
variables:
host:
default: localhost
description: Various servers (production, local development etc).
port:
default: "8080"
description: Port to reach server on.
enum:
- "8080"
- "9090"
basePath:
default: filemanagement
description: API version, for information on other supported versions see those
specifications.
tags:
- description: Operations for managing file storages such as S3.
name: storages
- description: Operations for managing files connected to data sources.
name: files
paths:
/files:
get:
operationId: find_files
parameters:
- description: Search for files based on metadata.
explode: true
in: query
name: metadata
required: false
schema:
type: string
style: form
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/FileDescription'
description: List of files matching the search criteria. List will be empty
if no files match the criteria.
tags:
- files
x-openapi-router-controller: filemanagement_service.controllers.files_controller
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (2 by maintainers)
Top Results From Across the Web
[Bug] OpenAPI import does not seem to honor default ... - GitHub
Details. I'm trying to import an OpenAPI 3 spec that uses variables in the server url. Default values are provided for these in...
Read more >API import restrictions and known issues - Azure
Details of known issues and restrictions on OpenAPI, WSDL, and WADL formats support in Azure API Management.
Read more >OpenAPI - document that was imported into - App Connect - IBM
You can import OpenAPI documents that contain API definitions into IBM App Connect. ... Variables are not supported for use with the servers...
Read more >PyCharm Educational 183.4588.180 Release Notes - YouTrack
Feature PY‑5138 Link to source code from .po files
Feature PY‑3454 Highlight HTTP links in reStructuredText
Feature PY‑3451 Support Structure View for reStructuredText
Feature PY‑2239 Custom...
Read more >Known issues - PaperCut
PaperCut Print Deploy: Defaults and Capabilities are not correctly captured on PaperCut Mobility Print queues when cloning. Server: 1.5.1805 Cloner: 493.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure if it is the same or not, but I also can not import OpenAPI to insomnia because of 2 errors.
Cannot read property 'map' of undefined
. This happens then you press “Import from File” button in a fresh workspace for example.The first error is also shown when you go to Application > Preferences under “Data” tab and use “Import from clipboard” option.
Sadly, currently it seems impossible to import an OpenAPI spec into insomnia.
Thanks for that @SylannBin! A missing
servers
declaration wasn’t handled by the openapi3 importer previously, resulting in those errors. I’m willing to say @vitaliis is experiencing the same thing as well.That has been resolved by #2007 though, and will be included in the next release of Insomnia Core. I confirmed by importing that specification successfully while running on the latest
develop
.This is because Designer already includes the fix 😄