Skip to content

Conversation

@niccolomineo
Copy link
Member

@niccolomineo niccolomineo commented Mar 25, 2022

Closes #84

@niccolomineo niccolomineo marked this pull request as draft March 25, 2022 17:19
@niccolomineo niccolomineo force-pushed the feature/162-openapi branch 2 times, most recently from 3bcfff3 to cd87a14 Compare March 27, 2022 12:14
@niccolomineo niccolomineo marked this pull request as ready for review March 27, 2022 12:15
"djangorestframework_camel_case.parser.CamelCaseMultiPartParser",
"djangorestframework_camel_case.parser.CamelCaseJSONParser",
],
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure whether to use AllowAny here. What do you think?

@niccolomineo niccolomineo force-pushed the feature/162-openapi branch 3 times, most recently from 5ca2b96 to c6b1829 Compare March 28, 2022 11:19
-r base.in
djangorestframework-camel-case~=1.3.0
djangorestframework~=3.13.0
drf-spectacular~=0.22.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss what exactly we should ask the user for, with the aim to make DRF an optional dependency.

@pauloxnet pauloxnet added the enhancement New feature or request label Mar 30, 2022
@niccolomineo niccolomineo force-pushed the feature/162-openapi branch from c6b1829 to d896d3d Compare April 1, 2022 16:00
@niccolomineo niccolomineo changed the title TG-162 Add API Documentation TG-162 Add API support Apr 1, 2022
@niccolomineo niccolomineo force-pushed the feature/162-openapi branch 2 times, most recently from 813ae10 to 606b7c8 Compare April 4, 2022 06:59
@niccolomineo niccolomineo marked this pull request as draft April 4, 2022 08:03
[
path(
"schema/",
staff_member_required(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead using staff_member_required here, drf_spectacular has a generic settings to protect his endpoints:

SPECTACULAR_SETTINGS = {
     "SERVE_PERMISSIONS": ["rest_framework.permissions.IsAuthenticated"],`
     ...
}

]

MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this strictly related to API documentation feature?
I would suggest doing a separate PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has evolved in its scope, hence the new title.

EMAIL_URL = var.email_url
SENTRY_DSN = var.sentry_dsn
DJANGO_SECRET_KEY = random_password.django_secret_key.result
DJANGO_ENABLE_API_DOC = var.environment_slug == "prod" ? "False" : "True"
Copy link
Contributor

@trottomv trottomv Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave a generic comment in this point as "food for thought" on what is the best way to integrate this functionality into the template (Talos), which I think is a great starting point.
But I'm not so sure that integrating it by default in the template could be the best solution, perhaps the most suitable solution could be a public package on a separate repository that can be integrated into the Talos Django backend with a simple pip install and adding it to the INSTALLED_APPS (?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we're embedding the API doc by default is that, this way, the API can be inspected and tested by our QA testers, as well.

"djangorestframework_camel_case.render.CamelCaseJSONRenderer",
],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}
Copy link
Contributor

@trottomv trottomv Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add also this settings
"JSON_UNDERSCOREIZE": {"no_underscore_before_number": True},

By default djangorestframework-camel-case leave an underscore before numbers (ex. customerAddress_1 and customerAddress_2) and this often leads to unwanted effects like in this issue:
vbabiy/djangorestframework-camel-case#50 (comment)

@niccolomineo niccolomineo changed the title TG-162 Add API support TG-800 Add API support Dec 5, 2022
@pauloxnet
Copy link
Contributor

Reopen when the US will be added in a sprint

@pauloxnet pauloxnet closed this Jan 10, 2023
@niccolomineo niccolomineo reopened this Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add api-docs with openapi

4 participants