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

Make suffix optional in POST and remove from PATCH. #168

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,18 +1016,30 @@ components:
properties:
code:
enum: [NOSU]
JobPostAttributes:
JobSuffixRequired:
type: object
additionalProperties: false
properties:
suffix:
type: string
nullable: false
maxLength: 2
description: >-
Used to uniquely identify a job record for persons who have multiple
jobs that share the same position number. For updating existing
jobs, this field is required.
jobs that share the same position number. This field is required.
JobSuffixOptional:
Copy link
Member

@tsoliangwu0130 tsoliangwu0130 Aug 29, 2022

Choose a reason for hiding this comment

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

Why do we have two suffix attributes defined and the only difference is nullable: true/false? I think what you should do are the following:

  1. Make suffix nullable: true in post attributes.
  2. Separate patch attributes from post attributes (you should still reuse common attributes by references).
  3. Remove suffix from patch attributes.
  4. Also make sure you modify the corresponding API codes including unit tests to reflect the change. For example, we will no longer need to check whether suffixes are matched between path and body for patch.

type: object
properties:
suffix:
type: string
nullable: true
maxLength: 2
description: >-
Used to uniquely identify a job record for persons who have multiple
jobs that share the same position number. This field is optional.
JobPostAttributes:
type: object
additionalProperties: false
properties:
positionNumber:
type: string
nullable: false
Expand Down Expand Up @@ -1534,6 +1546,7 @@ components:
attributes:
allOf:
- $ref: '#/components/schemas/JobAttributes'
- $ref: '#/components/schemas/JobSuffixRequired'
Copy link
Member

@tsoliangwu0130 tsoliangwu0130 Aug 29, 2022

Choose a reason for hiding this comment

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

I'm confused. Isn't suffix optional in POST?

- $ref: '#/components/schemas/JobPostAttributes'
JobSetResult:
type: object
Expand Down Expand Up @@ -1567,6 +1580,7 @@ components:
attributes:
allOf:
- $ref: '#/components/schemas/JobPostAttributes'
- $ref: '#/components/schemas/JobSuffixOptional'
- $ref: '#/components/schemas/JobPostRequired'
JobPatchBody:
type: object
Expand Down