-
Notifications
You must be signed in to change notification settings - Fork 49
Failure to parse data after get #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess fixed by #55 |
That looks like it is the issue. I don't have code/system set up to confirm that this is the fix right now though. |
Still getting this exact error, not sure what i'd need to include in the schema for this to disappear. The schema was generated using FastAPI. {
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"servers": [
{
"url": "http://localhost:8000",
"description": "Staging environment"
}
],
"paths": {
"/": {
"get": {
"summary": "Root",
"operationId": "root__get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/hello/{name}": {
"get": {
"summary": "Say Hello",
"operationId": "say_hello_hello__name__get",
"parameters": [
{
"required": true,
"schema": {
"title": "Name",
"type": "string"
},
"name": "name",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/HTTPValidationError"}
}
}
}
}
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {"$ref": "#/components/schemas/ValidationError"}
}
}
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {"type": "string"}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
}
}
}
} |
This is unrelated to the array problem.
Can you post the API signature for root__get and say_hello_hello__name__get?, I think they lack a definition for the response/return value. |
I'm hoping you mean the method signature: from fastapi import FastAPI
app = FastAPI(servers=[{"url": "http://localhost:8000", "description": "Staging environment"}, ])
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get("/hello/{name}")
async def say_hello(name: str):
return {"message": f"Hello {name}"} |
the response/return type is undefined. define it: from fastapi import FastAPI, BaseModel
app = FastAPI(servers=[{"url": "http://localhost:8000", "description": "Staging environment"}, ])
class Message(BaseModel):
message:str
@app.get("/", response_model=Message)
async def root():
return Message(message="Hello World")
@app.get("/hello/{name}", responses={200:{"model": Message}})
async def say_hello(name: str):
return Message(message=f"Hello {name}") untested. |
I'm using Django rest framework to auto generate a schema for a very simple API, one endpoint listGenes returns a json object which is an array of objects:
openapi3 correctly parses the schema and I can access the operations but when I called the listgenes operation, api.call_listGenes(), I get the following traceback:
The schema is
The text was updated successfully, but these errors were encountered: