-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
docs(api): Update create project api doc #50454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c34b23e
to
642d7e3
Compare
0d50b37
to
0a844bc
Compare
0a844bc
to
1c6995c
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #50454 +/- ##
==========================================
- Coverage 81.15% 81.14% -0.02%
==========================================
Files 4853 4854 +1
Lines 203739 203949 +210
Branches 11189 11188 -1
==========================================
+ Hits 165351 165500 +149
- Misses 38142 38203 +61
Partials 246 246
|
src/sentry/apidocs/parameters.py
Outdated
def NAME(description: str, required: str = False) -> str: | ||
return OpenApiParameter( | ||
name="name", | ||
location="query", | ||
required=required, | ||
type=str, | ||
description=description, | ||
) | ||
|
||
def SLUG(description: str, required: str = False) -> str: | ||
return OpenApiParameter( | ||
name="slug", | ||
location="query", | ||
required=required, | ||
type=str, | ||
description=description, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should both be global with the option to set the description and required b/c we use name and slug across several API tabs (eg: project, org, release, teams) w/ diff reqs and descriptions.
@@ -16,7 +21,7 @@ | |||
ERR_INVALID_STATS_PERIOD = "Invalid stats_period. Valid choices are '', '24h', '14d', and '30d'" | |||
|
|||
|
|||
class ProjectSerializer(serializers.Serializer): | |||
class ProjectPostSerializer(serializers.Serializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're required to change the name of this serializer b/c there is a duplicate ProjectSerializer
in the projects model and drf-spectacular/openapi yells at me
6c3a6b2
to
b955ea6
Compare
@@ -20,7 +20,7 @@ const makeApiDocsCommand = function () { | |||
} | |||
console.log('rebuilding OpenAPI schema...'); | |||
isCurrentlyRunning = true; | |||
const buildCommand = spawn('make', ['build-api-docs']); | |||
const buildCommand = spawn('make', ['-C', '../', 'build-api-docs']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The make watch-api-docs
command was broken before so this fixes it
|
||
def test_post(self): | ||
data = {"name": "foo"} | ||
response = self.client.post(self.url, data) | ||
request = RequestFactory().post(self.url, data) | ||
|
||
self.validate_schema(request, response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test can be safely deleted b/c typing is verified through drf/open-api
GLOBAL_PARAMS.NAME("The name of the project.", required=True), | ||
GLOBAL_PARAMS.SLUG( | ||
"Optional slug for the project. If not provided a slug is generated from the name." | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is currently confusing as NAME
is deprecated across the app, so only slug is used. Name is used in SCIM for compatibility, but it doesn't show anywhere in the UI. this may be confusing, but i guess it is just the state of things for now. not sure if there's any action to be taken here but I want to note that. cc @evanpurkhiser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to change those descriptions in a later PR. Part of the plan for cleaning up the APIs is to consolidate the use of name+slug for both teams and projects. I've noted this problem here on Notion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. not sure why the docs test is failing
It was failing b/c I deleted the json + path to json entirely for the url, but the GET needs it too |
The slug and name query parameter descriptions will be changed later.
Before:

After: (the full response example can be viewed here in a gist.)
