Backend API updated to indicate nullable fields

This commit is contained in:
bwilliams committed 2026-10-16 14:38:48 +01:00
1 parent e32e270db0
commit af7880ceac
3 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -21,4 +21,4 @@
// @description From GET /api/csrf; send its cookie too.
package api
//go:generate swag init --v3.1 --generalInfo doc.go --dir . --parseInternal --parseDependencyLevel 1 --outputTypes json --output openapi
//go:generate swag init --v3.1 --generalInfo doc.go --dir . --parseInternal --parseDependencyLevel 1 --requiredByDefault --outputTypes json --output openapi
+4 -4
View File
@@ -8,12 +8,12 @@ import (
// Problem is an RFC 9457 problem details body.
type Problem struct {
Type string `json:"type,omitempty"`
Type string `json:"type,omitempty" validate:"optional"`
Status int `json:"status"`
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
Instance string `json:"instance,omitempty"`
RequestID string `json:"requestId,omitempty"`
Detail string `json:"detail,omitempty" validate:"optional"`
Instance string `json:"instance,omitempty" validate:"optional"`
RequestID string `json:"requestId,omitempty" validate:"optional"`
}
// WriteProblem writes a problem+json error response.
+5 -5
View File
@@ -20,20 +20,20 @@ type Opportunity struct {
Status string `db:"status" json:"status"`
Description string `db:"description" json:"description"`
BuyerName string `db:"buyer_name" json:"buyer_name"`
Classifications []ClassificationCode `db:"-" json:"classifications"`
Classifications []ClassificationCode `db:"-" json:"classifications" extensions:"x-nullable"`
BuyerID string `db:"buyer_id" json:"buyer_id"`
MainCategory string `db:"main_category" json:"main_category"`
ProcurementMethod string `db:"procurement_method" json:"procurement_method"`
MultiLot bool `db:"multi_lot" json:"multi_lot"`
SMESuitable bool `db:"sme_suitable" json:"sme_suitable"`
VCSESuitable bool `db:"vcse_suitable" json:"vcse_suitable"`
StartDate *time.Time `db:"start_date" json:"start_date"`
EndDate *time.Time `db:"end_date" json:"end_date"`
StartDate *time.Time `db:"start_date" json:"start_date" extensions:"x-nullable"`
EndDate *time.Time `db:"end_date" json:"end_date" extensions:"x-nullable"`
GrossValue float64 `db:"gross_value" json:"gross_value"`
HasDocuments bool `db:"has_documents" json:"has_documents"`
Source string `db:"source" json:"source"`
LatestReleaseDate time.Time `db:"latest_release_date" json:"latest_release_date"`
Releases []OpportunityRelease `db:"-" json:"releases"`
Releases []OpportunityRelease `db:"-" json:"releases" extensions:"x-nullable"`
Marks OpportunityMarks `db:"-" json:"marks"`
}
@@ -43,7 +43,7 @@ type OpportunityRelease struct {
UUID string `db:"uuid" json:"uuid"`
ReleaseID string `db:"release_id" json:"release_id"`
ReleaseDate time.Time `db:"release_date" json:"release_date"`
Tags []OpportunityReleaseTag `db:"-" json:"release_tags"`
Tags []OpportunityReleaseTag `db:"-" json:"release_tags" extensions:"x-nullable"`
JSON string `db:"data" json:"data"`
}