Skip to content
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

docs(websoc): add openapi specifications to schema #87

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vinnyho
Copy link

@vinnyho vinnyho commented Jan 16, 2025

Description

  • Added openapi query & response specifications in websoc.ts based off of larc.ts

Related Issue

Closes #79

Motivation and Context

  • Improve API documentation by adding openapi specifications for WebSoc endpoints
  • Makes it easier for API consumers and developers

How Has This Been Tested?

  • Ran locally with changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code involves a change to the database schema.
  • My code requires a change to the documentation.

@laggycomputer laggycomputer self-requested a review January 16, 2025 19:01
Copy link
Member

@laggycomputer laggycomputer left a comment

Choose a reason for hiding this comment

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

Great progress! There are some inaccuracies that need addressing, but clean those up and these are great additions.

apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
@vinnyho
Copy link
Author

vinnyho commented Jan 18, 2025

Thanks for the suggestions, I apologize you had to leave a lot of suggestions on the PR that was bad of me

I added your suggested fixes, and added more clarification by including 'WebSoc' in the descriptions as larc.ts did. Please let me know if there are any other fixes necessary. Thanks!

@vinnyho vinnyho requested a review from laggycomputer January 18, 2025 01:23
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
apps/api/src/schema/websoc.ts Show resolved Hide resolved
apps/api/src/schema/websoc.ts Outdated Show resolved Hide resolved
@laggycomputer
Copy link
Member

laggycomputer commented Jan 18, 2025

Please also ensure you resolve the merge conflict, mark previous comments you've fixed as resolved, and modify the PR title pursuant to the conventional commits standard. Your PR will be squashed and rebased onto main using the PR title as the commit title and we require such commit titles follow conventional commits. This is also probably not a "feature update" since your changes are solely to documentation.

@andrew-wang0
Copy link
Member

andrew-wang0 commented Jan 20, 2025

@vinnyho looks like a lot of good progress so far! One small nitpick, could you rename the PR title to follow conventional commits

Something like docs(websoc): add openapi specifications to schema

@vinnyho vinnyho changed the title Add openapi query & response specifications to WebSoc schemas docs(websoc): add openapi specifications to schema Jan 21, 2025
@vinnyho
Copy link
Author

vinnyho commented Jan 21, 2025

The merge conflict conflict seems to be happening as I add the description and example for quarter and year, I don't think I can resolve it without just removing what I added.

@laggycomputer
Copy link
Member

laggycomputer commented Jan 21, 2025

The merge conflict conflict seems to be happening as I add the description and example for quarter and year, I don't think I can resolve it without just removing what I added.

A correct merge conflict resolution is an actual merge commit with the tip of your PR branch as first parent and origin/main as the second parent, or a cherrypick of such a merge commit. You need to make this merge commit yourself.

@vinnyho
Copy link
Author

vinnyho commented Jan 21, 2025

I believe I fixed the issue, but I don't know for sure. This is my first time dealing with merging conflicts as I didn't come across it with other PRs. Please let me know if I did anything wrong thank you

apps/api/src/schema/lib/day.ts Show resolved Hide resolved
apps/api/src/schema/websoc.ts Show resolved Hide resolved
apps/api/src/schema/websoc.ts Show resolved Hide resolved
ge: z
.enum(geCategories)
.optional()
.openapi({ description: "The general education category of the course", example: "GE-1A" })
Copy link
Member

Choose a reason for hiding this comment

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

Comment about singular course and notion of query search parameter vis-a-vis response subfield stands throughout this review.

apps/api/src/schema/websoc.ts Show resolved Hide resolved
sectionCodes: z
.string()
.optional()
.openapi({
description: "The section code of the course",
example: "35530",
Copy link
Member

Choose a reason for hiding this comment

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

The example should be expanded accordingly.

.transform((x) => (x === "ANY" ? undefined : x)),
sectionType: z
.union([z.enum(anyArray), z.enum(websocSectionTypes)])
.optional()
.openapi({
description: "Filter courses by section type",
Copy link
Member

Choose a reason for hiding this comment

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

Expanding on the comment extending throughout this review: A section type describes a section; a course as a whole is not a lecture or recitation. In fact, a course can have sections of only one type or of multiple. Then it doesn't make sense to claim you can "filter courses by section type". Reword accordingly.

}),
units: z.optional(z.literal("VAR").or(z.string())).openapi({
description:
"Filter courses by unit count. 'VAR' filters for courses with variable unit ranges (e.g., '1-4')",
Copy link
Member

Choose a reason for hiding this comment

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

That is not all of the functionality of this parameter.

excludeRestrictionCodes: z
.string()
.optional()
.openapi({
description:
"Exclude courses by comma-separated restriction codes, see [Registrar's list](https://www.reg.uci.edu/enrollment/restrict_codes.html)",
Copy link
Member

Choose a reason for hiding this comment

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

Earlier comment about a different display name for this link stands. You also need to clearly indicate in text that this is a link; look at your local copy of the REST reference to see why the current description is problematic.

openapi Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WebSoc] Add openapi query & response specifications to WebSoc schemas
3 participants