swagger-api/swagger-codegen
在 GitHub 查看[Python] Generated tests doesn't include required models properties
Open
#5,967 建立於 2017年7月2日
Client: PythonIssue: Workaround availablehelp wanted
描述
Description
The generated tests fail when a model has some required properties (e.g. https://travis-ci.org/FlatIO/api-client-python/jobs/249376469)
Swagger-codegen version
master (e50a4cca36)
Swagger declaration file content or url
AssignmentCopy:
description: Assignment copy operation
type: object
required:
- classroom
properties:
classroom:
type: string
description: The destination classroom where the assignment will be copied
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i https://flatio.github.io/api-reference/swagger.yaml -l python -c python-flat.json
{
"packageName": "flat_api",
"packageVersion": "0.3.0",
"packageUrl": "https://github.com/FlatIO/api-client-python"
}
Steps to reproduce
$ nosetests
======================================================================
ERROR: Test AssignmentCopy
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/FlatIO/api-client-python/test/test_assignment_copy.py", line 38, in testAssignmentCopy
model = flat_api.models.assignment_copy.AssignmentCopy()
File "/home/travis/build/FlatIO/api-client-python/flat_api/models/assignment_copy.py", line 48, in __init__
self.classroom = classroom
File "/home/travis/build/FlatIO/api-client-python/flat_api/models/assignment_copy.py", line 71, in classroom
raise ValueError("Invalid value for `classroom`, must not be `None`")
ValueError: Invalid value for `classroom`, must not be `None