Skip to content

Commit

Permalink
DRY out a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
vkurup committed Nov 6, 2023
1 parent bc792fb commit 2e59284
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 805 deletions.
52 changes: 1 addition & 51 deletions management/campaign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,57 +41,7 @@ paths:
content:
application/json:
schema:
type: object
required:
- AdvertiserId
- Name
- StartDateISO
properties:
AdvertiserId:
type: integer
format: int32
Name:
type: string
IsActive:
type: boolean
nullable: true
IsDeleted:
type: boolean
default: false
nullable: true
IsArchived:
type: boolean
default: false
nullable: true
FreqCap:
type: integer
format: int32
nullable: true
FreqCapDuration:
type: integer
format: int32
nullable: true
FreqCapType:
type: integer
format: int32
enum: [1, 2, 3]
nullable: true
DontAffectParentFreqCap:
type: boolean
nullable: true
CapType:
type: integer
format: int32
nullable: true
default: 4
DailyCapAmount:
type: integer
format: int32
nullable: true
LifetimeCapAmount:
type: integer
format: int32
nullable: true
$ref: './schemas/campaign.yaml#/schemas/Campaign'
responses:
200:
description: Campaign Created
Expand Down
2 changes: 1 addition & 1 deletion management/creative.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ paths:
content:
application/json:
schema:
$ref: './schemas/creative.yaml#/schemas/CreativeInput'
$ref: './schemas/creative.yaml#/schemas/Creative'
responses:
200:
description: Creative Created
Expand Down
2 changes: 1 addition & 1 deletion management/flight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ paths:
content:
application/json:
schema:
$ref: './schemas/flight.yaml#/schemas/FlightInput'
$ref: './schemas/flight.yaml#/schemas/Flight'
responses:
200:
description: Flight Created
Expand Down
162 changes: 67 additions & 95 deletions management/schemas/campaign.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
schemas:

Campaign:
CampaignBase:
type: object
required:
- AdvertiserId
- Name
- StartDate
properties:
AdvertiserId:
type: integer
format: int32
Name:
type: string
StartDate:
type: string
default: 1/1/2018
deprecated: true
Flights:
type: array
items:
type: object
nullable: true
minLength: 1
maxLength: 200
IsActive:
type: boolean
default: false
Expand All @@ -34,29 +26,35 @@ schemas:
FreqCap:
type: integer
format: int32
minimum: 1
nullable: true
FreqCapDuration:
type: integer
format: int32
minimum: 1
nullable: true
FreqCapType:
type: integer
format: int32
enum: [1, 2, 3]
nullable: true
DontAffectParentFreqCap:
type: boolean
nullable: true
CapType:
type: integer
format: int32
enum: [4]
nullable: true
DailyCapAmount:
type: integer
format: int32
minimum: 0
nullable: true
LifetimeCapAmount:
type: integer
format: int32
minimum: 0
nullable: true
Id:
type: integer
Expand All @@ -71,34 +69,55 @@ schemas:
IsFreqCap:
type: boolean
nullable: true
EndDateISO:
type: string
deprecated: true
nullable: true
Price:
type: number
deprecated: true
nullable: true
StartDateISO:
type: string
nullable: true
deprecated: true
Created:
type: string
format: date-time
nullable: true
LastModified:
type: string
format: date-time
nullable: true
Version:
type: integer
format: int32
nullable: true
SalespersonId:
type: integer
format: int32
nullable: true

Campaign:
allOf:
- $ref: '#/schemas/CampaignBase'
- type: object
required:
- CampaignId
- StartDate
properties:
SalespersonId:
type: integer
format: int32
nullable: true
StartDate:
type: string
default: 1/1/2018
deprecated: true
Flights:
type: array
items:
type: object
nullable: true
EndDateISO:
type: string
deprecated: true
nullable: true
Price:
type: number
deprecated: true
nullable: true
StartDateISO:
type: string
nullable: true
deprecated: true
Created:
type: string
format: date-time
nullable: true
readOnly: true
LastModified:
type: string
format: date-time
nullable: true
readOnly: true
Version:
type: integer
format: int32
nullable: true
readOnly: true

CampaignList:
type: object
Expand Down Expand Up @@ -127,62 +146,15 @@ schemas:
type: string

NestedCampaignInput:
type: object
required:
- AdvertiserId
- Name
properties:
AdvertiserId:
type: integer
format: int32
Name:
type: string
minLength: 1
maxLength: 200
IsActive:
type: boolean
default: false
CapType:
type: integer
format: int32
enum: [4]
nullable: true
DailyCapAmount:
type: integer
format: int32
minimum: 0
nullable: true
LifetimeCapAmount:
type: integer
format: int32
minimum: 0
nullable: true
FreqCapType:
type: integer
format: int32
enum: [1, 2, 3]
nullable: true
FreqCap:
type: integer
format: int32
minimum: 1
nullable: true
FreqCapDuration:
type: integer
format: int32
minimum: 1
nullable: true
DontAffectParentFreqCap:
type: boolean
nullable: true
CustomFieldsJSON:
type: string
nullable: true
Flights:
type: array
nullable: true
items:
$ref: './flight.yaml#/schemas/NestedFlightInput'
allOf:
- $ref: '#/schemas/CampaignBase'
- type: object
properties:
Flights:
type: array
nullable: true
items:
$ref: './flight.yaml#/schemas/NestedFlightInput'

NestedCampaignOutput:
type: object
Expand Down
Loading

0 comments on commit 2e59284

Please sign in to comment.