private/apigen: Fix bug TypeScript optional class members
The TypesScript generator generates classes and checks for Go struct field if the struct type is of a nullable type, however, it should check if the field types is nullable because it doesn't make sense to check that struct field for each field nor to assign to the field if it's nullable or not depending on it. Change-Id: Ia22a609a17752f520233c006cba17685fe142b32
This commit is contained in:
parent
bc7f621073
commit
ac86eb397a
@ -17,7 +17,7 @@ export class GetResponseItem {
|
||||
path: string;
|
||||
date: Time;
|
||||
metadata: Metadata;
|
||||
last_retrievals: GetResponseItemLastretrievals;
|
||||
last_retrievals?: GetResponseItemLastretrievals;
|
||||
}
|
||||
|
||||
export class GetResponseItemLastretrievalsItem {
|
||||
@ -27,7 +27,7 @@ export class GetResponseItemLastretrievalsItem {
|
||||
|
||||
export class Metadata {
|
||||
owner: string;
|
||||
tags: string[][];
|
||||
tags?: string[][];
|
||||
}
|
||||
|
||||
export class UpdateContentRequest {
|
||||
|
@ -174,7 +174,7 @@ func (types *Types) GenerateTypescriptDefinitions() string {
|
||||
}
|
||||
|
||||
isOptional := ""
|
||||
if isNillableType(t.Type) {
|
||||
if isNillableType(field.Type) {
|
||||
isOptional = "?"
|
||||
}
|
||||
|
||||
|
@ -8,13 +8,13 @@ export class APIKeyInfo {
|
||||
id: UUID;
|
||||
projectId: UUID;
|
||||
projectPublicId: UUID;
|
||||
userAgent: string;
|
||||
userAgent?: string;
|
||||
name: string;
|
||||
createdAt: Time;
|
||||
}
|
||||
|
||||
export class APIKeyPage {
|
||||
apiKeys: APIKeyInfo[];
|
||||
apiKeys?: APIKeyInfo[];
|
||||
search: string;
|
||||
limit: number;
|
||||
order: number;
|
||||
@ -46,7 +46,7 @@ export class CreateAPIKeyRequest {
|
||||
|
||||
export class CreateAPIKeyResponse {
|
||||
key: string;
|
||||
keyInfo: APIKeyInfo;
|
||||
keyInfo?: APIKeyInfo;
|
||||
}
|
||||
|
||||
export class Project {
|
||||
@ -54,18 +54,18 @@ export class Project {
|
||||
publicId: UUID;
|
||||
name: string;
|
||||
description: string;
|
||||
userAgent: string;
|
||||
userAgent?: string;
|
||||
ownerId: UUID;
|
||||
rateLimit: number;
|
||||
burstLimit: number;
|
||||
maxBuckets: number;
|
||||
rateLimit?: number;
|
||||
burstLimit?: number;
|
||||
maxBuckets?: number;
|
||||
createdAt: Time;
|
||||
memberCount: number;
|
||||
storageLimit: MemorySize;
|
||||
bandwidthLimit: MemorySize;
|
||||
userSpecifiedStorageLimit: MemorySize;
|
||||
userSpecifiedBandwidthLimit: MemorySize;
|
||||
segmentLimit: number;
|
||||
storageLimit?: MemorySize;
|
||||
bandwidthLimit?: MemorySize;
|
||||
userSpecifiedStorageLimit?: MemorySize;
|
||||
userSpecifiedBandwidthLimit?: MemorySize;
|
||||
segmentLimit?: number;
|
||||
defaultPlacement: number;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ export class ResponseUser {
|
||||
fullName: string;
|
||||
shortName: string;
|
||||
email: string;
|
||||
userAgent: string;
|
||||
userAgent?: string;
|
||||
projectLimit: number;
|
||||
isProfessional: boolean;
|
||||
position: string;
|
||||
|
Loading…
Reference in New Issue
Block a user