Skip to content

Commit

Permalink
Merge pull request #1371 from multiversx/SERVICES-2711-update-swagger…
Browse files Browse the repository at this point in the history
…-required-fields

 update swagger required fields
  • Loading branch information
bogdan-rosianu authored Nov 5, 2024
2 parents d8d62db + cbba948 commit af6b63a
Show file tree
Hide file tree
Showing 32 changed files with 164 additions and 157 deletions.
1 change: 1 addition & 0 deletions src/common/entities/scam-info.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class ScamInfo {
Object.assign(this, init);
}

@ApiProperty({ type: String, nullable: true })
type?: string | null;

@ApiProperty({ type: String, nullable: true })
Expand Down
1 change: 1 addition & 0 deletions src/endpoints/accounts/account.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ export class AccountController {
@ApiQuery({ name: 'after', description: 'After timestamp', required: false })
@ApiQuery({ name: 'identifier', description: 'Filter by multiple esdt identifiers, comma-separated', required: false })
@ApiQuery({ name: 'token', description: 'Token identifier', required: false })
@ApiOkResponse({ type: [AccountEsdtHistory] })
async getAccountEsdtHistory(
@Param('address', ParseAddressPipe) address: string,
@Query('from', new DefaultValuePipe(0), ParseIntPipe) from: number,
Expand Down
36 changes: 18 additions & 18 deletions src/endpoints/accounts/entities/account.detailed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,64 @@ export class AccountDetailed extends Account {
Object.assign(this, init);
}

@ApiProperty({ description: 'The source code in hex format' })
@ApiProperty({ description: 'The source code in hex format', required: false })
code: string = '';

@ApiProperty({ description: 'The hash of the source code' })
@ApiProperty({ description: 'The hash of the source code', required: false })
codeHash: string = '';

@ApiProperty({ description: 'The hash of the root node' })
rootHash: string = '';

@ApiProperty({ description: 'The username specific for this account', nullable: true })
@ApiProperty({ description: 'The username specific for this account', nullable: true, required: false })
username: string | undefined = undefined;

@ApiProperty({ description: 'The developer reward' })
developerReward: string = '';

@ApiProperty({ description: 'The address in bech 32 format of owner account' })
@ApiProperty({ description: 'The address in bech 32 format of owner account', required: false })
ownerAddress: string = '';

@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean })
@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false })
isUpgradeable?: boolean;

@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean })
@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false })
isReadable?: boolean;

@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean })
@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false })
isPayable?: boolean;

@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, nullable: true })
@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, nullable: true, required: false })
isPayableBySmartContract?: boolean | undefined = undefined;

@ApiProperty({ type: ScamInfo, nullable: true })
@ApiProperty({ type: ScamInfo, nullable: true, required: false })
scamInfo: ScamInfo | undefined = undefined;

@ApiProperty({ description: 'Account nft collections', type: Boolean, nullable: true })
@ApiProperty({ description: 'Account nft collections', type: Boolean, nullable: true, required: false })
nftCollections: NftCollectionAccount[] | undefined = undefined;

@ApiProperty({ description: 'Account nfts', type: Boolean, nullable: true })
@ApiProperty({ description: 'Account nfts', type: Boolean, nullable: true, required: false })
@ComplexityEstimation({ group: 'nfts', value: 1000 })
nfts: NftAccount[] | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
activeGuardianActivationEpoch?: number;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
activeGuardianAddress?: string;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
activeGuardianServiceUid?: string;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
pendingGuardianActivationEpoch?: number;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
pendingGuardianAddress?: string;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
pendingGuardianServiceUid?: string;

@ApiProperty({ type: Boolean, nullable: true })
@ApiProperty({ type: Boolean, nullable: true, required: false })
isGuarded?: boolean;
}
2 changes: 1 addition & 1 deletion src/endpoints/accounts/entities/account.history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export class AccountHistory {
@ApiProperty({ type: Number, example: 10000 })
timestamp: number = 0;

@ApiProperty({ type: Boolean, nullable: true, example: true })
@ApiProperty({ type: Boolean, nullable: true, example: true, required: false })
isSender?: boolean | undefined = undefined;
}
12 changes: 6 additions & 6 deletions src/endpoints/accounts/entities/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ export class Account {
@ApiProperty({ type: Number, description: 'The shard ID allocated to the account', example: 0 })
shard: number = 0;

@ApiProperty({ type: String, description: 'Current owner address' })
@ApiProperty({ type: String, description: 'Current owner address', required: false })
ownerAddress: string | undefined = undefined;

@ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' })
@ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false })
assets: AccountAssets | undefined = undefined;

@ApiProperty({ description: 'Specific property flag for smart contract', type: Number })
@ApiProperty({ description: 'Specific property flag for smart contract', type: Number, required: false })
deployedAt?: number | null;

@ApiProperty({ description: 'The contract deploy transaction hash' })
@ApiProperty({ description: 'The contract deploy transaction hash', required: false })
deployTxHash?: string | null;

@ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' })
@ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false })
ownerAssets: AccountAssets | undefined = undefined;

@ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false })
Expand All @@ -46,6 +46,6 @@ export class Account {
@ApiProperty({ description: 'The number of smart contract results of this account' })
scrCount?: number;

@ApiProperty({ type: Number, description: 'Transfers in the last 24 hours' })
@ApiProperty({ type: Number, description: 'Transfers in the last 24 hours', required: false })
transfersLast24h: number | undefined = undefined;
}
4 changes: 2 additions & 2 deletions src/endpoints/accounts/entities/account.verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export class AccountVerification {
@ApiProperty({ description: 'Source code hash' })
codeHash?: string = '';

@ApiProperty({ description: 'Source code of contract', type: AccountVerificationSource })
@ApiProperty({ description: 'Source code of contract', type: AccountVerificationSource, required: false })
source?: any;

@ApiProperty({ description: 'Verifier process status', enum: AccountVerificationStatus })
status!: AccountVerificationStatus;

@ApiProperty({ description: 'File hash for IPFS' })
@ApiProperty({ description: 'File hash for IPFS', required: false })
ipfsFileHash?: string;
}
2 changes: 1 addition & 1 deletion src/endpoints/accounts/entities/deployed.contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export class DeployedContract {
@ApiProperty({ type: Number })
timestamp: number = 0;

@ApiProperty({ type: AccountAssets, nullable: true, description: 'Contract assets' })
@ApiProperty({ type: AccountAssets, nullable: true, required: false, description: 'Contract assets' })
assets: AccountAssets | undefined = undefined;
}
4 changes: 2 additions & 2 deletions src/endpoints/blocks/entities/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Block {
@ApiProperty({ type: String })
proposer: string = '';

@ApiProperty({ type: Identity, nullable: true })
@ApiProperty({ type: Identity, nullable: true, required: false })
proposerIdentity: Identity | undefined = undefined;

@ApiProperty({ type: String })
Expand Down Expand Up @@ -61,7 +61,7 @@ export class Block {
@ApiProperty({ type: Number })
maxGasLimit: number = 0;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
scheduledRootHash: string | undefined = undefined;

static mergeWithElasticResponse<T extends Block>(newBlock: T, blockRaw: any): T {
Expand Down
14 changes: 7 additions & 7 deletions src/endpoints/collections/entities/nft.collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ export class NftCollection {
@ApiProperty({ type: Number, nullable: true })
decimals: number | undefined = undefined;

@ApiProperty({ type: TokenAssets, nullable: true })
@ApiProperty({ type: TokenAssets, nullable: true, required: false })
assets: TokenAssets | undefined = undefined;

@ApiProperty({ type: ScamInfo, nullable: true })
@ApiProperty({ type: ScamInfo, nullable: true, required: false })
scamInfo: ScamInfo | undefined = undefined;

@ApiProperty({ type: CollectionTrait, isArray: true })
@ApiProperty({ type: CollectionTrait, isArray: true, required: false })
traits: CollectionTrait[] = [];

@ApiProperty({ type: CollectionAuctionStats, nullable: true })
@ApiProperty({ type: CollectionAuctionStats, nullable: true, required: false })
auctionStats: CollectionAuctionStats | undefined = undefined;

@ApiProperty({ type: Boolean, nullable: true })
@ApiProperty({ type: Boolean, nullable: true, required: false })
isVerified: boolean | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
holderCount: number | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
nftCount: number | undefined = undefined;
}
16 changes: 8 additions & 8 deletions src/endpoints/identities/entities/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export class Identity {
@ApiProperty({ type: String })
description?: string;

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
avatar?: string;

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
website?: string;

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
twitter?: string;

@ApiProperty({ type: String })
location?: string;

@ApiProperty({ type: Number })
@ApiProperty({ type: Number, required: false })
score?: number;

@ApiProperty({ type: Number })
Expand All @@ -45,15 +45,15 @@ export class Identity {
@ApiProperty()
distribution?: { [index: string]: number | undefined } = {};

@ApiProperty({ type: [String] })
@ApiProperty({ type: [String], required: false })
providers?: string[];

@ApiProperty({ type: Number })
@ApiProperty({ type: Number, required: false })
stakePercent?: number;

@ApiProperty({ type: Number })
@ApiProperty({ type: Number, required: false })
rank?: number;

@ApiProperty({ type: Number })
@ApiProperty({ type: Number, required: false })
apr?: number;
}
2 changes: 1 addition & 1 deletion src/endpoints/mex/entities/mex.farm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class MexFarm {
@ApiProperty({ enum: MexFarmType })
type: MexFarmType = MexFarmType.standard;

@ApiProperty({ nullable: true })
@ApiProperty({ nullable: true, required: false })
version?: string;

@ApiProperty({ type: String, example: 'erd1qqqqqqqqqqqqqpgqzps75vsk97w9nsx2cenv2r2tyxl4fl402jpsx78m9j' })
Expand Down
6 changes: 3 additions & 3 deletions src/endpoints/network/entities/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export class About {
@ApiProperty({ type: String, nullable: true })
appVersion: string | undefined = undefined;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
pluginsVersion: string | undefined = undefined;

@ApiProperty({ type: String })
network: string = '';

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
cluster: string = '';

@ApiProperty({ type: String })
Expand All @@ -27,7 +27,7 @@ export class About {
@ApiProperty({ type: String })
gatewayVersion: string | undefined = undefined;

@ApiProperty({ type: String, nullable: true })
@ApiProperty({ type: String, nullable: true, required: false })
scamEngineVersion: string | undefined = undefined;

@ApiProperty({ type: FeatureConfigs, nullable: true })
Expand Down
4 changes: 2 additions & 2 deletions src/endpoints/nfts/entities/nft.account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export class NftAccount extends Nft {
@ApiProperty({ type: String, example: 10 })
balance: string = '';

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
price: number | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
valueUsd: number | undefined = undefined;
}
22 changes: 11 additions & 11 deletions src/endpoints/nfts/entities/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ export class Nft {
@ApiProperty({ type: String })
url: string = '';

@ApiProperty({ type: NftMedia, nullable: true })
@ApiProperty({ type: NftMedia, nullable: true, required: false })
media: NftMedia[] | undefined = undefined;

@ApiProperty({ type: Boolean, default: false })
@ApiProperty({ type: Boolean, default: false, required: false })
isWhitelistedStorage: boolean = false;

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
thumbnailUrl: string = '';

@ApiProperty({ type: String, isArray: true })
@ApiProperty({ type: String, isArray: true, required: false })
tags: string[] = [];

@ApiProperty({ type: NftMetadata, nullable: true })
Expand All @@ -79,30 +79,30 @@ export class Nft {
@ApiProperty({ type: Number, nullable: true })
decimals: number | undefined = undefined;

@ApiProperty({ type: TokenAssets })
@ApiProperty({ type: TokenAssets, required: false })
assets?: TokenAssets;

@ApiProperty({ type: String })
ticker?: string = '';

@ApiProperty({ type: ScamInfo, nullable: true })
@ApiProperty({ type: ScamInfo, nullable: true, required: false })
scamInfo: ScamInfo | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
score: number | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
rank: number | undefined = undefined;

@ApiProperty({ type: NftRarities, nullable: true })
@ApiProperty({ type: NftRarities, nullable: true, required: false })
rarities: NftRarities | undefined = undefined;

@ApiProperty({ type: Boolean, nullable: true })
isNsfw: boolean | undefined = undefined;

@ApiProperty({ type: [UnlockMileStoneModel], nullable: true })
@ApiProperty({ type: [UnlockMileStoneModel], nullable: true, required: false })
unlockSchedule?: UnlockMileStoneModel[] | undefined = undefined;

@ApiProperty({ type: Number, nullable: true })
@ApiProperty({ type: Number, nullable: true, required: false })
unlockEpoch?: number | undefined = undefined;
}
8 changes: 4 additions & 4 deletions src/endpoints/nodes/entities/node.auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export class NodeAuction {
@ApiProperty({ type: String })
name?: string = '';

@ApiProperty({ type: String, default: 0 })
@ApiProperty({ type: String, default: 0, required: false })
description: string = '';

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
avatar: string = '';

@ApiProperty({ type: String })
@ApiProperty({ type: String, required: false })
provider?: string = '';

@ApiProperty({ type: String })
Expand All @@ -29,7 +29,7 @@ export class NodeAuction {
@ApiProperty({ type: String })
owner: string = '';

@ApiProperty()
@ApiProperty({ required: false })
distribution?: { [index: string]: number | undefined } = {};

@ApiProperty({ type: String })
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/nodes/entities/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class Node {
@ApiProperty({ type: Number, example: 15 })
epochsLeft: number | undefined = undefined;

@ApiProperty({ type: Identity, nullable: true })
@ApiProperty({ type: Identity, nullable: true, required: false })
identityInfo?: Identity;

@ApiProperty({ type: String, default: 0 })
Expand Down
Loading

0 comments on commit af6b63a

Please sign in to comment.