flasgger / flasgger/flasgger

Unable to reference in array items in parameters

Open
#96 7 comments 3 reactions 0 assignees View on GitHub
hacktoberfest
Dominant language
Python
Stars
3.7k
Forks
525
PR merge metrics
No merged PRs in 30d

Description

Hi,

first I want to say: thank you - for your open source work.
Second: I must blame myself as completely new to this whole flask, rest, swagger thing,
so maybe it is just my fault, but after trying several days all possible variations I'm very lost now.
So third - "the" problem:

when I expand your `examples/test_validation.yml` with
```
diff --git a/examples/test_validation.yml b/examples/test_validation.yml
index 66b3508..3094847 100644
--- a/examples/test_validation.yml
+++ b/examples/test_validation.yml
@@ -27,6 +27,18 @@ parameters:
default: ["wizard", "hogwarts", "dead"]
items:
type: string
+ myobjects:
+ type: array
+ items:
+ $ref: '#/definitions/MyDefinedObject'
+
+definitions:
+
+ MyDefinedObject:
+ type: object
+ properties:
+ myProperty:
+ type: string

responses:
200:
```
[test_validation_working_docs.txt](https://github.com/rochacbruno/flasgger/files/963789/test_validation_working_docs.txt)

than the documentation looks perfect and matches the specification.
But unfortunately when I try with:
```
curl -X POST -H "Content-Type: application/json" -d '{
"age": 180,
"tags": [
"wizard",
"hogwarts",
"dead"
],
"username": "Sirius Black",
"myobjects": [
{"myProperty": "somevalue"}
]
}' http://127.0.0.1:5000/autovalidation
```
the response is: `RefResolutionError: Unresolvable JSON pointer: u'definitions/MyDefinedObject'`.

I can get it to work without the array definition around my custom type, but I really need an array here.

Any kind of comment, suggestion, help or at least some pointers into a direction would be very welcomed !

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.