This repository was archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
This repository was archived by the owner on Aug 29, 2024. It is now read-only.
issue resolving $ref: AttributeError: 'list' object has no attribute 'items' #54
Copy link
Copy link
Open
Labels
Description
in my opinion swagger-parser is not handling $ref correctly (see trace at the bottom). I tried with both python2.7 and python3.6. This relates to validate_request - definitions_example works fine.
relevant part of my spec:
definitions:
NotificationARNs:
type: array
items:
type: string
example: arn:aws:sns:eu-west-1:123456789012:mytopic1
stack:
type: object
properties:
StackName:
type: string
example: infra-dev-kumo-sample-stack
RoleARN:
type: string
example: arn:aws:iam::<AccountID>:role/<CloudFormationRoleName>
NotificationARNs:
$ref: '#/definitions/NotificationARNs'if I resolve the $ref manually it works fine:
definitions:
#NotificationARNs:
# type: array
# items:
# type: string
# example: arn:aws:sns:eu-west-1:123456789012:mytopic1
stack:
type: object
properties:
StackName:
type: string
example: team-dev-my-application-stack
RoleARN:
type: string
#$ref: '#/definitions/parameters'
pattern: "arn:aws:([a-zA-Z0-9-])+:([a-z]{2}-[a-z]+-d{1})?:(d{12})?:(.*)"
example: arn:aws:iam::<AccountID>:role/<CloudFormationRoleName>
NotificationARNs:
type: array
items:
type: string
example: arn:aws:sns:eu-west-1:123456789012:mytopic1
#$ref: '#/definitions/NotificationARNs'Traceback (most recent call last):
File "config_validate_kumo.py", line 37, in <module>
parser.validate_request('/kumo', 'get', body=my_config)
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 713, in validate_request
is_ok, msg = self._validate_body_parameters(body, action_spec)
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 793, in _validate_body_parameters
if not self.validate_definition(definition_name, body):
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 508, in validate_definition
if not self._validate_type(properties_dict[key], value):
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 526, in _validate_type
return self.validate_definition(def_name, value)
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 508, in validate_definition
if not self._validate_type(properties_dict[key], value):
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 526, in _validate_type
return self.validate_definition(def_name, value)
File "/Users/fin0007m/devel/gcdt/bvenv/lib/python2.7/site-packages/swagger_parser/swagger_parser.py", line 503, in validate_definition
for key, value in dict_to_test.items():
AttributeError: 'list' object has no attribute 'items'
Reactions are currently unavailable