File tree Expand file tree Collapse file tree 2 files changed +106
-0
lines changed
Expand file tree Collapse file tree 2 files changed +106
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ from click .testing import CliRunner
3+
4+ from openapi_python_generator .__main__ import main
5+ from openapi_python_generator .common import HTTPLibrary
6+ from tests .conftest import test_data_folder
7+ from tests .conftest import test_result_path
8+
9+
10+ @pytest .fixture
11+ def runner () -> CliRunner :
12+ """Fixture for invoking command-line interfaces."""
13+ return CliRunner ()
14+
15+
16+ @pytest .mark .parametrize (
17+ "library" ,
18+ [HTTPLibrary .httpx , HTTPLibrary .aiohttp , HTTPLibrary .requests ],
19+ )
20+ def test_issue_87 (runner : CliRunner , model_data_with_cleanup , library ) -> None :
21+ """
22+ https://github.com/MarcoMuellner/openapi-python-generator/issues/87
23+ """
24+ result = runner .invoke (
25+ main ,
26+ [
27+ str (test_data_folder / "issue_87.json" ),
28+ str (test_result_path ),
29+ "--library" ,
30+ library .value ,
31+ ],
32+ )
33+ assert result .exit_code == 0
Original file line number Diff line number Diff line change 1+ {
2+ "openapi" : " 3.0.2" ,
3+ "info" : {
4+ "title" : " Title" ,
5+ "version" : " 1.0"
6+ },
7+ "paths" : {
8+ "/users" : {
9+ "get" : {
10+ "summary" : " Get users" ,
11+ "description" : " Returns a list of users." ,
12+ "operationId" : " users_get" ,
13+ "parameters" : [
14+ {
15+ "name" : " type" ,
16+ "in" : " query" ,
17+ "required" : true ,
18+ "schema" : {
19+ "$ref" : " #/components/schemas/UserType"
20+ }
21+ }
22+ ],
23+ "responses" : {
24+ "200" : {
25+ "description" : " Successful response" ,
26+ "content" : {
27+ "application/json" : {
28+ "schema" : {
29+ "type" : " array" ,
30+ "items" : {
31+ "$ref" : " #/components/schemas/User"
32+ }
33+ }
34+ }
35+ }
36+ }
37+ }
38+ }
39+ }
40+ },
41+ "components" : {
42+ "schemas" : {
43+ "UserType" : {
44+ "title" : " UserType" ,
45+ "description" : " An enumeration." ,
46+ "enum" : [
47+ " admin-user" ,
48+ " regular-user"
49+ ]
50+ },
51+ "User" : {
52+ "title" : " User" ,
53+ "description" : " A user." ,
54+ "type" : " object" ,
55+ "properties" : {
56+ "id" : {
57+ "type" : " string" ,
58+ "format" : " uuid"
59+ },
60+ "name" : {
61+ "type" : " string"
62+ },
63+ "type" : {
64+ "$ref" : " #/components/schemas/UserType"
65+ },
66+ "30d_active" : {
67+ "type" : " boolean"
68+ }
69+ }
70+ }
71+ }
72+ }
73+ }
You can’t perform that action at this time.
0 commit comments