File tree 4 files changed +8
-5
lines changed
example/tests/__snapshots__
rest_framework_json_api/schemas
4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ Safa AlFulaij <safa1996alfulaij@gmail.com>
39
39
santiavenda <santiavenda2@gmail.com>
40
40
Sergey Kolomenkin <https://kolomenkin.com>
41
41
Stas S. <stas@nerd.ro>
42
+ Steven A. <sha0160@protonmail.com>
42
43
Swaraj Baral <baralswaraj40@gmail.com>
43
44
Tim Selman <timcbaoth@gmail.com>
44
45
Tom Glowka <glowka.tom@gmail.com>
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ any parts of the framework not mentioned in the documentation should generally b
16
16
* Avoid error when ` parser_context ` is ` None ` while parsing.
17
17
* Raise comprehensible error when reserved field names ` meta ` and ` results ` are used.
18
18
* Use ` relationships ` in the error object ` pointer ` when the field is actually a relationship.
19
+ * Added missing inflection to the generated OpenAPI schema.
19
20
20
21
### Changed
21
22
Original file line number Diff line number Diff line change 133
133
"entries": {
134
134
"$ref": "#/components/schemas/reltomany"
135
135
},
136
- "first_entry ": {
136
+ "firstEntry ": {
137
137
"$ref": "#/components/schemas/reltoone"
138
138
},
139
139
"type": {
541
541
"entries": {
542
542
"$ref": "#/components/schemas/reltomany"
543
543
},
544
- "first_entry ": {
544
+ "firstEntry ": {
545
545
"$ref": "#/components/schemas/reltoone"
546
546
},
547
547
"type": {
Original file line number Diff line number Diff line change 7
7
from rest_framework .schemas .utils import is_list_view
8
8
9
9
from rest_framework_json_api import serializers , views
10
+ from rest_framework_json_api .utils import format_field_name
10
11
11
12
12
13
class SchemaGenerator (drf_openapi .SchemaGenerator ):
@@ -655,12 +656,12 @@ def map_serializer(self, serializer):
655
656
if isinstance (field , serializers .HiddenField ):
656
657
continue
657
658
if isinstance (field , serializers .RelatedField ):
658
- relationships [field .field_name ] = {
659
+ relationships [format_field_name ( field .field_name ) ] = {
659
660
"$ref" : "#/components/schemas/reltoone"
660
661
}
661
662
continue
662
663
if isinstance (field , serializers .ManyRelatedField ):
663
- relationships [field .field_name ] = {
664
+ relationships [format_field_name ( field .field_name ) ] = {
664
665
"$ref" : "#/components/schemas/reltomany"
665
666
}
666
667
continue
@@ -682,7 +683,7 @@ def map_serializer(self, serializer):
682
683
schema ["description" ] = str (field .help_text )
683
684
self .map_field_validators (field , schema )
684
685
685
- attributes [field .field_name ] = schema
686
+ attributes [format_field_name ( field .field_name ) ] = schema
686
687
687
688
result = {
688
689
"type" : "object" ,
You can’t perform that action at this time.
0 commit comments