Skip to content

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

Merged
merged 18 commits into from
Jun 9, 2023

Conversation

schew2381
Copy link
Contributor

@schew2381 schew2381 commented Jun 6, 2023

The slug and name query parameter descriptions will be changed later.

Before:
Screenshot 2023-06-08 at 2 34 34 PM

After: (the full response example can be viewed here in a gist.)
Screenshot 2023-06-08 at 2 34 06 PM

@codecov
Copy link

codecov bot commented Jun 8, 2023

Codecov Report

Merging #50454 (c6aa55b) into master (416cd28) will decrease coverage by 0.02%.
The diff coverage is 98.52%.

❗ Current head c6aa55b differs from pull request most recent head c2b4ebf. Consider uploading reports for the commit c2b4ebf to get more accurate results

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              
Impacted Files Coverage Δ
.../app/components/calendar/calendarStylesWrapper.tsx 100.00% <ø> (ø)
static/app/components/dropdownMenu/item.tsx 82.50% <ø> (ø)
static/app/components/gridEditable/styles.tsx 100.00% <ø> (ø)
src/sentry/api/endpoints/team_projects.py 95.08% <90.00%> (-1.15%) ⬇️
.../api/endpoints/organization_projects_experiment.py 100.00% <100.00%> (ø)
src/sentry/apidocs/examples/project_examples.py 100.00% <100.00%> (ø)
src/sentry/apidocs/parameters.py 100.00% <100.00%> (ø)
src/sentry/tasks/integrations/github/pr_comment.py 100.00% <100.00%> (ø)
...eb/frontend/integration_extension_configuration.py 98.70% <100.00%> (+2.75%) ⬆️

... and 62 files with indirect coverage changes

Comment on lines 73 to 89
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,
)
Copy link
Contributor Author

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):
Copy link
Contributor Author

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

@schew2381 schew2381 force-pushed the seiji/fix/update-project-creation-api-doc branch from 6c3a6b2 to b955ea6 Compare June 8, 2023 18:19
@schew2381 schew2381 requested a review from sentaur-athena June 8, 2023 20:55
@@ -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']);
Copy link
Contributor Author

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

Comment on lines -24 to -30

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)
Copy link
Contributor Author

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

@schew2381 schew2381 requested a review from JoshFerge June 9, 2023 16:55
Comment on lines 110 to 113
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."
),
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

@JoshFerge JoshFerge left a 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

@schew2381 schew2381 changed the title WIP(api): Start proj creation api update docs(api): Update create project api doc Jun 9, 2023
@schew2381 schew2381 marked this pull request as ready for review June 9, 2023 17:16
@schew2381 schew2381 requested a review from a team as a code owner June 9, 2023 17:16
@schew2381
Copy link
Contributor Author

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

@schew2381 schew2381 merged commit 1a3443e into master Jun 9, 2023
@schew2381 schew2381 deleted the seiji/fix/update-project-creation-api-doc branch June 9, 2023 18:32
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants