swagger-api / swagger-api/swagger-codegen

connexion.exceptions.InvalidSpecification

Open
#9,619 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

trying to get this working with python 2.7 flask

Swagger-codegen version

swagger: "2.0"

Swagger declaration file content or url

import flask
from flask import request
import connexion
from flask import render_template

import sqlite3

app = connexion.App(name,specification_dir = "Api/" )
app.add_api("api.yaml", base_path='/1.0')

@app.route('/')
def home_page():
"""
This function just responds to the browser URL /
:return: the rendered template 'home.html'
"""

return render_template('home.html')

@app.errorhandler(500)
def internal_error(e):
return "

500

Internal Server Error unexpected request

", 500

@app.route('/apps/api/ucmTechMediumsLATLON', methods=['GET'])
error massages

raise InvalidSpecification.create_from(e)
connexion.exceptions.InvalidSpecification: {'required': 'true', 'type': 'string', 'description': 'longitude in decimal degrees', 'in': 'path', 'name': 'LON'} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['parameters']['items']:
{'oneOf': [{'$ref': '#/definitions/parameter'},
{'$ref': '#/definitions/jsonReference'}]}

On instance['paths']['/apps/api/ucmTechMediumsLATLON']['get']['parameters'][0]:
{'description': 'longitude in decimal degrees',
'in': 'path',
'name': 'LON',
'required': 'true',
'type': 'string'}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the api.yaml parameter definitions under /apps/api/ucmTechMediumsLATLON and the connexion.App.add_api call shown in the report. Compare the path parameters with the Swagger 2.0 validation error, then run the Flask application to confirm the specification loads successfully. Done means the reported InvalidSpecification error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.