Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c016b8b

Browse files
authored
Document how to override DRF generateschema generator_class. (#1084)
* Document how to override DRF generateschema generator_class. * changelog
1 parent c8511a0 commit c016b8b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ any parts of the framework not mentioned in the documentation should generally b
2121
* Added support for Django 4.1.
2222
* Expanded JSONParser API with `parse_data` method
2323

24+
### Changed
25+
26+
* Improved documentation of how to override DRF's generateschema `--generator_class` to generate a proper DJA OAS schema.
27+
2428
### Removed
2529

2630
* Removed support for Django 2.2.

‎docs/usage.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,11 +1085,10 @@ class MySchemaGenerator(JSONAPISchemaGenerator):
10851085
### Generate a Static Schema on Command Line
10861086

10871087
See [DRF documentation for generateschema](https://www.django-rest-framework.org/api-guide/schemas/#generating-a-static-schema-with-the-generateschema-management-command)
1088-
To generate an OAS schema document, use something like:
1088+
To generate a static OAS schema document, using the `generateschema` management command, you **must override DRF's default**`generator_class` with the DJA-specific version:
10891089

10901090
```text
1091-
$ django-admin generateschema --settings=example.settings \
1092-
--generator_class myapp.views.MySchemaGenerator >myschema.yaml
1091+
$ ./manage.py generateschema --generator_class rest_framework_json_api.schemas.openapi.SchemaGenerator
10931092
```
10941093

10951094
You can then use any number of OAS tools such as

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /