Skip to content

Commit 72dba3d

Browse files
committed
Refactor, calling out deprecated v0 to v1
1 parent da24b72 commit 72dba3d

File tree

5 files changed

+126
-22
lines changed

5 files changed

+126
-22
lines changed

model/contracts.smithy

Lines changed: 87 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ enum ContractVariableType {
2929
INTERNAL_CITATION = "internal_citation"
3030
}
3131

32+
structure EqSection {
33+
@documentation("deprecation path (v0.5)")
34+
terms: TermsList
35+
36+
//v1 version
37+
eqModeData: EQModeData
38+
}
39+
40+
structure IqSection {
41+
@documentation("deprecation path (v0.5)")
42+
qa_sections: QASectionsList
43+
44+
// v1 version
45+
46+
}
3247

3348
// Contract operations
3449
@http(method: "POST", uri: "/getContract")
@@ -58,12 +73,15 @@ structure GetContractOutput {
5873
@required
5974
type: ContractType
6075

61-
@required
76+
@documentation("deprecation path (v0)")
6277
terms: TermsList
6378

64-
@required
79+
@documentation("deprecation path (v0)")
6580
qa_sections: String
6681

82+
eq_section: EqSection
83+
iq_section: IqSection
84+
6785
@required
6886
isOwner: Boolean
6987

@@ -452,34 +470,90 @@ structure QA {
452470
}
453471

454472
// Special Contract Structures (only the stable ones)
473+
enum EqCardKey {
474+
MONEY_RECEIVED = "moneyYouReceive"
475+
OWNERSHIP = "whatYouOwn"
476+
RESPONSIBILITES = "whatYoureResponsibleFor"
477+
DURATION = "howLongThisDealLasts"
478+
LEGAL = "risksCostsLegalStuff"
479+
}
480+
481+
// TODO Gwyn fill out these card structures
482+
structure EqMoneyCard {
483+
majorNumber: String,
484+
}
485+
486+
structure EqOwnershipCard {
487+
}
488+
489+
structure EqResponsibilitesCard {
490+
}
491+
492+
structure EqDurationCard {
493+
durationText: String,
494+
endDate: String,
495+
}
496+
497+
structure EqLegalCard {
498+
}
499+
500+
union EqCardUniqueData {
501+
MONEY_RECEIVED: EqMoneyCard
502+
OWNERSHIP: EqOwnershipCard
503+
RESPONSIBILITES: EqResponsibilitesCard
504+
DURATION: EqDurationCard
505+
LEGAL: EqLegalCard
506+
EMPTY: EmptyStructure
507+
}
455508

456509
// EQMode data structure - matches the eqmode field in seniSpecialData
457510
map EQModeData {
458-
key: String // Section key (e.g., "moneyYouReceive", "whatYouOwn")
511+
key: EqCardKey
459512
value: EQModeCard
460513
}
461514

515+
enum EqCardType {
516+
@documentation("v0")
517+
A = "A"
518+
519+
@documentation("v1")
520+
B = "B"
521+
}
522+
462523
// Individual EQMode card
463524
structure EQModeCard {
464525
@required
465-
id: String
526+
id: EqCardKey
466527

467528
@required
468529
title: String
469530

470531
@required
471-
type: String
532+
type: EqCardType
533+
534+
@required
535+
cardUniqueData: EqCardUniqueData
472536

537+
@documentation("Deprecated, use subTitle Instead")
473538
eqTitle: String
539+
subTitle: String
540+
541+
@documentation("Deprecated, this should be in the in a custom subtype")
474542
totalAdvance: String
475-
audioSrc: String
543+
544+
@documentation("Deprecated, this should be in the in a custom subtype")
476545
items: EQModeItemList
477-
}
478546

547+
@documentation("Deprecated, use the ttsSrcUrl")
548+
audioSrc: String
549+
550+
ttsSrcUrl: Url
551+
}
552+
@documentation("Deprecated")
479553
list EQModeItemList {
480554
member: EQModeItem
481555
}
482-
556+
@documentation("Deprecated")
483557
structure EQModeItem {
484558
title: String
485559
value: String
@@ -544,6 +618,7 @@ structure GlossarizedTerm {
544618
section: String
545619
}
546620

621+
// Deprecated. Currently, used for SpecialContract only. Use alternative for real contract.
547622
@http(method: "POST", uri: "/getTTSURLs")
548623
operation GetTTSURLs {
549624
input: GetTTSURLsInput
@@ -555,19 +630,22 @@ operation GetTTSURLs {
555630
]
556631
}
557632

633+
// Deprecated. Currently, used for SpecialContract only. Use alternative for real contract.
558634
structure GetTTSURLsInput {
559635
@required
560636
contractId: ContractId
561637
}
562638

639+
// Deprecated. Currently, used for SpecialContract only. Use alternative for real contract.
563640
structure GetTTSURLsOutput {
564641
@required
565642
contractId: ContractId
566643

567644
@required
568-
tts_presigned_urls: TTSPresignedUrlMap
645+
ttsSrcUrl: TTSPresignedUrlMap
569646
}
570647

648+
// Deprecated. Currently, used for SpecialContract only. Use alternative for real contract.
571649
// Map of audio source IDs to presigned URLs
572650
map TTSPresignedUrlMap {
573651
key: String // AudioSrcId

model/util.smithy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ namespace equaliq
44

55
// Shared types used across operations - keep these in main file for reference
66

7+
structure EmptyStructure {
8+
// Empty structure - avoid using, but useful in data migrations or making union workable
9+
}
10+
711
// Common patterns
812
@mixin
913
@pattern("^[A-Za-z0-9-]+$")
@@ -12,6 +16,8 @@ string UuidLikeMixin
1216
@pattern("^[\\w-\\.]+@[\\w-\\.]+\\.+[\\w-]{1,63}$")
1317
string Email
1418

19+
string Url // Putting a regex on this is a nightmare, so leaving it open for now
20+
1521
// Generics
1622
list StringList {
1723
member: String

python/api_model/types/models.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ class ContractVariable(BaseModel):
278278
definitionCitation: Optional[str] = None
279279

280280

281+
class EqSection(BaseModel):
282+
terms: Optional[List[Term]] = None
283+
284+
281285
class ExposeTypesResponseContent(BaseModel):
282286
QASectionsList: Optional[List[QASection]] = None
283287
ContractVariable_1: Optional[ContractVariable] = Field(
@@ -288,17 +292,6 @@ class ExposeTypesResponseContent(BaseModel):
288292
)
289293

290294

291-
class GetContractResponseContent(BaseModel):
292-
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
293-
name: str
294-
type: ContractType
295-
terms: List[Term]
296-
qa_sections: str
297-
isOwner: bool
298-
ownerId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
299-
sharedWith: List[SharedWithItem]
300-
301-
302295
class GetProfileResponseContent(BaseModel):
303296
userId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
304297
profile: UserProfile
@@ -313,6 +306,10 @@ class GetUploadURLResponseContent(BaseModel):
313306
url_info: PresignedPostData
314307

315308

309+
class IqSection(BaseModel):
310+
qa_sections: Optional[List[QASection]] = None
311+
312+
316313
class ListContractsResponseContent(BaseModel):
317314
owned: List[ContractSummaryItem]
318315
shared: List[ContractSummaryItem]
@@ -330,3 +327,16 @@ class ShareContractResponseContent(BaseModel):
330327
added: Optional[List[AddedItem]] = None
331328
removed: Optional[List[RemovedItem]] = None
332329
invalidRemoves: Optional[List[InvalidRemove]] = None
330+
331+
332+
class GetContractResponseContent(BaseModel):
333+
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
334+
name: str
335+
type: ContractType
336+
terms: Optional[List[Term]] = None
337+
qa_sections: Optional[str] = None
338+
eq_section: Optional[EqSection] = None
339+
iq_section: Optional[IqSection] = None
340+
isOwner: bool
341+
ownerId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
342+
sharedWith: List[SharedWithItem]

typescript/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type ContractSummaryItem = ExtractSchema<'ContractSummaryItem'>
1616
export type ContractVariable = ExtractSchema<'ContractVariable'>
1717
export type DeleteContractRequestContent = ExtractSchema<'DeleteContractRequestContent'>
1818
export type DeleteContractResponseContent = ExtractSchema<'DeleteContractResponseContent'>
19+
export type EqSection = ExtractSchema<'EqSection'>
1920
export type ExposeTypesResponseContent = ExtractSchema<'ExposeTypesResponseContent'>
2021
export type FixedTermValue = ExtractSchema<'FixedTermValue'>
2122
export type FixedValueTermInference = ExtractSchema<'FixedValueTermInference'>
@@ -34,6 +35,7 @@ export type GetTTSURLsResponseContent = ExtractSchema<'GetTTSURLsResponseContent
3435
export type GetUploadURLRequestContent = ExtractSchema<'GetUploadURLRequestContent'>
3536
export type GetUploadURLResponseContent = ExtractSchema<'GetUploadURLResponseContent'>
3637
export type InternalServerErrorResponseContent = ExtractSchema<'InternalServerErrorResponseContent'>
38+
export type IqSection = ExtractSchema<'IqSection'>
3739
export type ListContractsResponseContent = ExtractSchema<'ListContractsResponseContent'>
3840
export type ListSpecialContractsResponseContent = ExtractSchema<'ListSpecialContractsResponseContent'>
3941
export type PingResponseContent = ExtractSchema<'PingResponseContent'>

typescript/src/models.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ export interface components {
308308
DeleteContractResponseContent: {
309309
success: boolean;
310310
};
311+
EqSection: {
312+
terms?: components["schemas"]["Term"][];
313+
};
311314
ExposeTypesResponseContent: {
312315
QASectionsList?: components["schemas"]["QASection"][];
313316
ContractVariable?: components["schemas"]["ContractVariable"];
@@ -338,8 +341,10 @@ export interface components {
338341
contractId: string;
339342
name: string;
340343
type: components["schemas"]["ContractType"];
341-
terms: components["schemas"]["Term"][];
342-
qa_sections: string;
344+
terms?: components["schemas"]["Term"][];
345+
qa_sections?: string;
346+
eq_section?: components["schemas"]["EqSection"];
347+
iq_section?: components["schemas"]["IqSection"];
343348
isOwner: boolean;
344349
ownerId: string;
345350
sharedWith: string[];
@@ -386,6 +391,9 @@ export interface components {
386391
InternalServerErrorResponseContent: {
387392
message: string;
388393
};
394+
IqSection: {
395+
qa_sections?: components["schemas"]["QASection"][];
396+
};
389397
ListContractsResponseContent: {
390398
owned: components["schemas"]["ContractSummaryItem"][];
391399
shared: components["schemas"]["ContractSummaryItem"][];

0 commit comments

Comments
 (0)