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

Model changes for switching to auto-generated swagger docs #1172

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions script/generate-types
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ cd "$(dirname "$0")/.."

echo "==> Generating types..."

npx openapi-typescript-codegen -i https://raw.githubusercontent.com/ministryofjustice/hmpps-approved-premises-api/main/src/main/resources/static/codegen/built-api-spec.yml -o ./server/@types/shared -c axios --exportServices false --exportCore false --useUnionTypes true
npx openapi-typescript-codegen -i https://raw.githubusercontent.com/ministryofjustice/hmpps-approved-premises-api/main/src/main/resources/static/codegen/built-cas3-api-spec.yml -o ./server/@types/shared -c axios --exportServices false --exportCore false --useUnionTypes true
npx openapi-typescript-codegen -i "https://approved-premises-api-dev.hmpps.service.justice.gov.uk/v3/api-docs/CAS3Shared" -o ./server/@types/shared -c axios --exportServices false --exportCore false --useUnionTypes true

echo "==> Renaming the declaration file..."

Expand Down
41 changes: 8 additions & 33 deletions server/@types/shared/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
export type { ActiveOffence } from './models/ActiveOffence';
export type { Adjudication } from './models/Adjudication';
export type { AllocatedFilter } from './models/AllocatedFilter';
export type { AnyValue } from './models/AnyValue';
export type { ApArea } from './models/ApArea';
export type { Appeal } from './models/Appeal';
export type { AppealDecision } from './models/AppealDecision';
export type { Application } from './models/Application';
export type { ApplicationSortField } from './models/ApplicationSortField';
export type { ApplicationStatus } from './models/ApplicationStatus';
export type { ApplicationSummary } from './models/ApplicationSummary';
export type { ApplicationTimeline } from './models/ApplicationTimeline';
Expand All @@ -30,15 +28,6 @@ export type { ApprovedPremisesUser } from './models/ApprovedPremisesUser';
export type { ApprovedPremisesUserPermission } from './models/ApprovedPremisesUserPermission';
export type { ApprovedPremisesUserRole } from './models/ApprovedPremisesUserRole';
export type { ApType } from './models/ApType';
export type { ArrayOfOASysOffenceDetailsQuestions } from './models/ArrayOfOASysOffenceDetailsQuestions';
export type { ArrayOfOASysRiskContributorsQuestions } from './models/ArrayOfOASysRiskContributorsQuestions';
export type { ArrayOfOASysRiskManagementPlanQuestions } from './models/ArrayOfOASysRiskManagementPlanQuestions';
export type { ArrayOfOASysRiskManagementQuestions } from './models/ArrayOfOASysRiskManagementQuestions';
export type { ArrayOfOASysRiskOfSeriousHarmSummaryQuestions } from './models/ArrayOfOASysRiskOfSeriousHarmSummaryQuestions';
export type { ArrayOfOASysRisksToOthersQuestions } from './models/ArrayOfOASysRisksToOthersQuestions';
export type { ArrayOfOASysRisksToTheIndividualQuestions } from './models/ArrayOfOASysRisksToTheIndividualQuestions';
export type { ArrayOfOASysRiskToSelfQuestions } from './models/ArrayOfOASysRiskToSelfQuestions';
export type { ArrayOfOASysSupportingInformationQuestions } from './models/ArrayOfOASysSupportingInformationQuestions';
export type { Arrival } from './models/Arrival';
export type { Assessment } from './models/Assessment';
export type { AssessmentAcceptance } from './models/AssessmentAcceptance';
Expand All @@ -61,7 +50,6 @@ export type { BedStatus } from './models/BedStatus';
export type { BedSummary } from './models/BedSummary';
export type { Booking } from './models/Booking';
export type { BookingAppealTask } from './models/BookingAppealTask';
export type { BookingBody } from './models/BookingBody';
export type { BookingNotMade } from './models/BookingNotMade';
export type { BookingPremisesSummary } from './models/BookingPremisesSummary';
export type { BookingSearchResult } from './models/BookingSearchResult';
Expand All @@ -74,29 +62,22 @@ export type { BookingSearchResults } from './models/BookingSearchResults';
export type { BookingSearchSortField } from './models/BookingSearchSortField';
export type { BookingStatus } from './models/BookingStatus';
export type { BookingSummary } from './models/BookingSummary';
export type { CacheType } from './models/CacheType';
export type { Cancellation } from './models/Cancellation';
export type { CancellationReason } from './models/CancellationReason';
export type { Cas1ApplicationTimelinessCategory } from './models/Cas1ApplicationTimelinessCategory';
export type { Cas1ApplicationUserDetails } from './models/Cas1ApplicationUserDetails';
export type { Cas1CruManagementArea } from './models/Cas1CruManagementArea';
export type { Cas2Application } from './models/Cas2Application';
export type { Cas2ApplicationNote } from './models/Cas2ApplicationNote';
export type { Cas2ApplicationStatus } from './models/Cas2ApplicationStatus';
export type { Cas2ApplicationStatusDetail } from './models/Cas2ApplicationStatusDetail';
export type { Cas2ApplicationSummary } from './models/Cas2ApplicationSummary';
export type { Cas2Assessment } from './models/Cas2Assessment';
export type { Cas2AssessmentStatusUpdate } from './models/Cas2AssessmentStatusUpdate';
export type { Cas2ReportName } from './models/Cas2ReportName';
export type { Cas2StatusUpdate } from './models/Cas2StatusUpdate';
export type { Cas2StatusUpdateDetail } from './models/Cas2StatusUpdateDetail';
export type { Cas2SubmittedApplication } from './models/Cas2SubmittedApplication';
export type { Cas2SubmittedApplicationSummary } from './models/Cas2SubmittedApplicationSummary';
export type { Cas2TimelineEvent } from './models/Cas2TimelineEvent';
export type { Cas3ReportType } from './models/Cas3ReportType';
export type { Category } from './models/Category';
export type { Characteristic } from './models/Characteristic';
export type { CharacteristicPair } from './models/CharacteristicPair';
export type { ClarificationNote } from './models/ClarificationNote';
export type { ClassesToInclude } from './models/ClassesToInclude';
export type { Confirmation } from './models/Confirmation';
export type { DateCapacity } from './models/DateCapacity';
export type { DateChange } from './models/DateChange';
Expand All @@ -106,15 +87,17 @@ export type { DepartureReason } from './models/DepartureReason';
export type { DestinationProvider } from './models/DestinationProvider';
export type { Document } from './models/Document';
export type { DocumentLevel } from './models/DocumentLevel';
export type { ErrorResponse } from './models/ErrorResponse';
export type { ExtendedPremisesSummary } from './models/ExtendedPremisesSummary';
export type { Extension } from './models/Extension';
export type { ExternalUser } from './models/ExternalUser';
export type { FlagsEnvelope } from './models/FlagsEnvelope';
export type { FullPerson } from './models/FullPerson';
export type { FullPersonSummary } from './models/FullPersonSummary';
export type { Gender } from './models/Gender';
export type { HmppsSubjectAccessRequestContent } from './models/HmppsSubjectAccessRequestContent';
export type { InvalidParam } from './models/InvalidParam';
export type { LatestCas2StatusUpdate } from './models/LatestCas2StatusUpdate';
export type { LoadError } from './models/LoadError';
export type { LocalAuthorityArea } from './models/LocalAuthorityArea';
export type { LostBed } from './models/LostBed';
export type { LostBedCancellation } from './models/LostBedCancellation';
Expand All @@ -124,17 +107,16 @@ export type { Mappa } from './models/Mappa';
export type { MappaEnvelope } from './models/MappaEnvelope';
export type { MigrationJobRequest } from './models/MigrationJobRequest';
export type { MigrationJobType } from './models/MigrationJobType';
export type { ModelScope } from './models/ModelScope';
export type { MoveOnCategory } from './models/MoveOnCategory';
export type { NamedId } from './models/NamedId';
export type { NewAppeal } from './models/NewAppeal';
export type { NewApplication } from './models/NewApplication';
export type { NewApplicationTimelineNote } from './models/NewApplicationTimelineNote';
export type { NewArrival } from './models/NewArrival';
export type { NewBedMove } from './models/NewBedMove';
export type { NewBooking } from './models/NewBooking';
export type { NewBookingNotMade } from './models/NewBookingNotMade';
export type { NewCancellation } from './models/NewCancellation';
export type { NewCas2ApplicationNote } from './models/NewCas2ApplicationNote';
export type { NewCas2Arrival } from './models/NewCas2Arrival';
export type { NewCas3Arrival } from './models/NewCas3Arrival';
export type { NewClarificationNote } from './models/NewClarificationNote';
Expand All @@ -156,7 +138,6 @@ export type { NewWithdrawal } from './models/NewWithdrawal';
export type { NomisUser } from './models/NomisUser';
export type { Nonarrival } from './models/Nonarrival';
export type { NonArrivalReason } from './models/NonArrivalReason';
export type { OASysAssessmentId } from './models/OASysAssessmentId';
export type { OASysAssessmentState } from './models/OASysAssessmentState';
export type { OASysQuestion } from './models/OASysQuestion';
export type { OASysRiskOfSeriousHarm } from './models/OASysRiskOfSeriousHarm';
Expand Down Expand Up @@ -184,7 +165,6 @@ export type { PlacementDates } from './models/PlacementDates';
export type { PlacementRequest } from './models/PlacementRequest';
export type { PlacementRequestDetail } from './models/PlacementRequestDetail';
export type { PlacementRequestRequestType } from './models/PlacementRequestRequestType';
export type { PlacementRequestSortField } from './models/PlacementRequestSortField';
export type { PlacementRequestStatus } from './models/PlacementRequestStatus';
export type { PlacementRequestTask } from './models/PlacementRequestTask';
export type { PlacementRequestTaskOutcome } from './models/PlacementRequestTaskOutcome';
Expand Down Expand Up @@ -215,32 +195,28 @@ export type { RestrictedPersonSummary } from './models/RestrictedPersonSummary';
export type { RiskEnvelopeStatus } from './models/RiskEnvelopeStatus';
export type { RiskTier } from './models/RiskTier';
export type { RiskTierEnvelope } from './models/RiskTierEnvelope';
export type { RiskTierLevel } from './models/RiskTierLevel';
export type { Room } from './models/Room';
export type { RoshRisks } from './models/RoshRisks';
export type { RoshRisksEnvelope } from './models/RoshRisksEnvelope';
export type { SeedFileType } from './models/SeedFileType';
export type { SeedRequest } from './models/SeedRequest';
export type { SentenceTypeOption } from './models/SentenceTypeOption';
export type { ServiceName } from './models/ServiceName';
export type { ServiceScope } from './models/ServiceScope';
export type { SituationOption } from './models/SituationOption';
export type { SortDirection } from './models/SortDirection';
export type { SortOrder } from './models/SortOrder';
export type { StaffMember } from './models/StaffMember';
export type { SubmitApplication } from './models/SubmitApplication';
export type { SubmitApprovedPremisesApplication } from './models/SubmitApprovedPremisesApplication';
export type { SubmitCas2Application } from './models/SubmitCas2Application';
export type { SubmitPlacementApplication } from './models/SubmitPlacementApplication';
export type { SubmitTemporaryAccommodationApplication } from './models/SubmitTemporaryAccommodationApplication';
export type { SupervisingOfficer } from './models/SupervisingOfficer';
export type { SupervisingProvider } from './models/SupervisingProvider';
export type { SupervisingTeam } from './models/SupervisingTeam';
export type { Task } from './models/Task';
export type { TaskSortField } from './models/TaskSortField';
export type { TaskStatus } from './models/TaskStatus';
export type { TaskType } from './models/TaskType';
export type { TaskWrapper } from './models/TaskWrapper';
export type { Temporality } from './models/Temporality';
export type { TemporaryAccommodationApplication } from './models/TemporaryAccommodationApplication';
export type { TemporaryAccommodationApplicationSummary } from './models/TemporaryAccommodationApplicationSummary';
export type { TemporaryAccommodationAssessment } from './models/TemporaryAccommodationAssessment';
Expand All @@ -259,6 +235,7 @@ export type { TimelineEventType } from './models/TimelineEventType';
export type { TimelineEventUrlType } from './models/TimelineEventUrlType';
export type { TriggerSourceType } from './models/TriggerSourceType';
export type { Turnaround } from './models/Turnaround';
export type { Type } from './models/Type';
export type { Unit } from './models/Unit';
export type { UnknownPerson } from './models/UnknownPerson';
export type { UnknownPersonSummary } from './models/UnknownPersonSummary';
Expand All @@ -267,7 +244,6 @@ export type { UpdateApplicationType } from './models/UpdateApplicationType';
export type { UpdateApprovedPremisesApplication } from './models/UpdateApprovedPremisesApplication';
export type { UpdateAssessment } from './models/UpdateAssessment';
export type { UpdateCas2Application } from './models/UpdateCas2Application';
export type { UpdateCas2Assessment } from './models/UpdateCas2Assessment';
export type { UpdatedClarificationNote } from './models/UpdatedClarificationNote';
export type { UpdateLostBed } from './models/UpdateLostBed';
export type { UpdatePlacementApplication } from './models/UpdatePlacementApplication';
Expand All @@ -277,7 +253,6 @@ export type { UpdateTemporaryAccommodationApplication } from './models/UpdateTem
export type { User } from './models/User';
export type { UserQualification } from './models/UserQualification';
export type { UserRolesAndQualifications } from './models/UserRolesAndQualifications';
export type { UserSortField } from './models/UserSortField';
export type { UserSummary } from './models/UserSummary';
export type { UserWithWorkload } from './models/UserWithWorkload';
export type { ValidationError } from './models/ValidationError';
Expand Down
8 changes: 0 additions & 8 deletions server/@types/shared/models/AnyValue.ts

This file was deleted.

5 changes: 3 additions & 2 deletions server/@types/shared/models/Appeal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
/* tslint:disable */
/* eslint-disable */
import type { AppealDecision } from './AppealDecision';
import type { User } from './User';
import type { ApprovedPremisesUser } from './ApprovedPremisesUser';
import type { TemporaryAccommodationUser } from './TemporaryAccommodationUser';
export type Appeal = {
id: string;
appealDate: string;
Expand All @@ -12,7 +13,7 @@ export type Appeal = {
decisionDetail: string;
createdAt: string;
applicationId: string;
createdByUser: (ApprovedPremisesUser | TemporaryAccommodationUser);
assessmentId?: string;
createdByUser: User;
};

8 changes: 5 additions & 3 deletions server/@types/shared/models/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Person } from './Person';
import type { FullPerson } from './FullPerson';
import type { RestrictedPerson } from './RestrictedPerson';
import type { UnknownPerson } from './UnknownPerson';
export type Application = {
type: string;
id: string;
person: Person;
type: string;
person: (FullPerson | RestrictedPerson | UnknownPerson);
createdAt: string;
};

5 changes: 0 additions & 5 deletions server/@types/shared/models/ApplicationSortField.ts

This file was deleted.

10 changes: 6 additions & 4 deletions server/@types/shared/models/ApplicationSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Person } from './Person';
import type { FullPerson } from './FullPerson';
import type { RestrictedPerson } from './RestrictedPerson';
import type { UnknownPerson } from './UnknownPerson';
export type ApplicationSummary = {
type: string;
id: string;
person: Person;
createdAt: string;
type: string;
submittedAt?: string;
person: (FullPerson | RestrictedPerson | UnknownPerson);
createdAt: string;
};

7 changes: 4 additions & 3 deletions server/@types/shared/models/ApplicationTimeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/* tslint:disable */
/* eslint-disable */
import type { ApprovedPremisesApplicationStatus } from './ApprovedPremisesApplicationStatus';
import type { ApprovedPremisesUser } from './ApprovedPremisesUser';
import type { TemporaryAccommodationUser } from './TemporaryAccommodationUser';
import type { TimelineEvent } from './TimelineEvent';
import type { User } from './User';
export type ApplicationTimeline = {
id: string;
createdAt: string;
isOfflineApplication: boolean;
status?: ApprovedPremisesApplicationStatus;
createdBy?: User;
timelineEvents: Array<TimelineEvent>;
status?: ApprovedPremisesApplicationStatus;
createdBy?: (ApprovedPremisesUser | TemporaryAccommodationUser);
};

10 changes: 4 additions & 6 deletions server/@types/shared/models/ApplicationTimelineNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { User } from './User';
/**
* Notes added to an application
*/
import type { ApprovedPremisesUser } from './ApprovedPremisesUser';
import type { TemporaryAccommodationUser } from './TemporaryAccommodationUser';
export type ApplicationTimelineNote = {
id?: string;
createdByUser?: User;
note: string;
id?: string;
createdByUser?: (ApprovedPremisesUser | TemporaryAccommodationUser);
createdAt?: string;
};

33 changes: 21 additions & 12 deletions server/@types/shared/models/ApprovedPremisesApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,47 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { AnyValue } from './AnyValue';
import type { ApArea } from './ApArea';
import type { Application } from './Application';
import type { ApprovedPremisesApplicationStatus } from './ApprovedPremisesApplicationStatus';
import type { ApType } from './ApType';
import type { AssessmentDecision } from './AssessmentDecision';
import type { Cas1ApplicationUserDetails } from './Cas1ApplicationUserDetails';
import type { Cas1CruManagementArea } from './Cas1CruManagementArea';
import type { FullPerson } from './FullPerson';
import type { PersonRisks } from './PersonRisks';
import type { PersonStatus } from './PersonStatus';
export type ApprovedPremisesApplication = (Application & {
import type { RestrictedPerson } from './RestrictedPerson';
import type { UnknownPerson } from './UnknownPerson';
export type ApprovedPremisesApplication = {
createdByUserId: string;
schemaVersion: string;
outdatedSchema: boolean;
status: ApprovedPremisesApplicationStatus;
type: string;
id: string;
person: (FullPerson | RestrictedPerson | UnknownPerson);
createdAt: string;
isWomensApplication?: boolean;
/**
* Use apType
* @deprecated
*/
isPipeApplication?: boolean;
isEmergencyApplication?: boolean;
/**
* Use apType
* @deprecated
*/
isEsapApplication?: boolean;
apType?: ApType;
arrivalDate?: string;
risks?: PersonRisks;
createdByUserId: string;
schemaVersion: string;
outdatedSchema: boolean;
data?: AnyValue;
document?: AnyValue;
status: ApprovedPremisesApplicationStatus;
/**
* Any object that conforms to the current JSON schema for an application
*/
data?: Record<string, any>;
/**
* Any object that conforms to the current JSON schema for an application
*/
document?: Record<string, any>;
assessmentId?: string;
assessmentDecision?: AssessmentDecision;
assessmentDecisionDate?: string;
Expand All @@ -48,5 +57,5 @@ export type ApprovedPremisesApplication = (Application & {
caseManagerIsNotApplicant?: boolean;
caseManagerUserDetails?: Cas1ApplicationUserDetails;
licenceExpiryDate?: string;
});
};

Loading
Loading