Better compatibility with go-swagger

Adding `"x-nullable": true` to date fields and `"x-omitempty": true` to arrays to ensure that the resulting JSON doesn't include empty dates and empty arrays are not rendered as "null" when using go-swagger to generate a client
This commit is contained in:
Alessandro (Ale) Segala 2021-04-13 21:05:38 -07:00 коммит произвёл GitHub
Родитель f55dcebace
Коммит 4c8855dde4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 70 добавлений и 35 удалений

Просмотреть файл

@ -560,7 +560,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ChannelAccount" "$ref": "#/definitions/ChannelAccount"
} },
"x-omitempty": true
} }
}, },
"default": { "default": {
@ -748,7 +749,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ChannelAccount" "$ref": "#/definitions/ChannelAccount"
} },
"x-omitempty": true
} }
}, },
"default": { "default": {
@ -844,7 +846,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/AttachmentView" "$ref": "#/definitions/AttachmentView"
} },
"x-omitempty": true
} }
} }
}, },
@ -923,7 +926,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ChannelAccount" "$ref": "#/definitions/ChannelAccount"
} },
"x-omitempty": true
}, },
"topicName": { "topicName": {
"description": "(Optional) Topic of the conversation (if supported by the channel)", "description": "(Optional) Topic of the conversation (if supported by the channel)",
@ -980,12 +984,14 @@
"timestamp": { "timestamp": {
"format": "date-time", "format": "date-time",
"description": "Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.", "description": "Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format.",
"type": "string" "type": "string",
"x-nullable": true
}, },
"localTimestamp": { "localTimestamp": {
"format": "date-time", "format": "date-time",
"description": "Contains the local date and time of the message, expressed in ISO-8601 format.\r\nFor example, 2016-09-23T13:07:49.4714686-07:00.", "description": "Contains the local date and time of the message, expressed in ISO-8601 format.\r\nFor example, 2016-09-23T13:07:49.4714686-07:00.",
"type": "string" "type": "string",
"x-nullable": true
}, },
"localTimezone": { "localTimezone": {
"description": "Contains the name of the local timezone of the message, expressed in IANA Time Zone database format.\r\nFor example, America/Los_Angeles.", "description": "Contains the name of the local timezone of the message, expressed in IANA Time Zone database format.\r\nFor example, America/Los_Angeles.",
@ -1028,28 +1034,32 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ChannelAccount" "$ref": "#/definitions/ChannelAccount"
} },
"x-omitempty": true
}, },
"membersRemoved": { "membersRemoved": {
"description": "The collection of members removed from the conversation.", "description": "The collection of members removed from the conversation.",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ChannelAccount" "$ref": "#/definitions/ChannelAccount"
} },
"x-omitempty": true
}, },
"reactionsAdded": { "reactionsAdded": {
"description": "The collection of reactions added to the conversation.", "description": "The collection of reactions added to the conversation.",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MessageReaction" "$ref": "#/definitions/MessageReaction"
} },
"x-omitempty": true
}, },
"reactionsRemoved": { "reactionsRemoved": {
"description": "The collection of reactions removed from the conversation.", "description": "The collection of reactions removed from the conversation.",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MessageReaction" "$ref": "#/definitions/MessageReaction"
} },
"x-omitempty": true
}, },
"topicName": { "topicName": {
"description": "The updated topic name of the conversation.", "description": "The updated topic name of the conversation.",
@ -1088,14 +1098,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/Attachment" "$ref": "#/definitions/Attachment"
} },
"x-omitempty": true
}, },
"entities": { "entities": {
"description": "Represents the entities that were mentioned in the message.", "description": "Represents the entities that were mentioned in the message.",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/Entity" "$ref": "#/definitions/Entity"
} },
"x-omitempty": true
}, },
"channelData": { "channelData": {
"description": "Contains channel-specific content.", "description": "Contains channel-specific content.",
@ -1136,7 +1148,8 @@
"expiration": { "expiration": {
"format": "date-time", "format": "date-time",
"description": "The time at which the activity should be considered to be \"expired\" and should not be presented to the recipient.", "description": "The time at which the activity should be considered to be \"expired\" and should not be presented to the recipient.",
"type": "string" "type": "string",
"x-nullable": true
}, },
"importance": { "importance": {
"$ref": "#/definitions/ActivityImportance", "$ref": "#/definitions/ActivityImportance",
@ -1151,14 +1164,16 @@
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} },
"x-omitempty": true
}, },
"textHighlights": { "textHighlights": {
"description": "The collection of text fragments to highlight when the activity contains a ReplyToId value.", "description": "The collection of text fragments to highlight when the activity contains a ReplyToId value.",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/TextHighlight" "$ref": "#/definitions/TextHighlight"
} },
"x-omitempty": true
}, },
"semanticAction": { "semanticAction": {
"$ref": "#/definitions/SemanticAction", "$ref": "#/definitions/SemanticAction",
@ -1511,14 +1526,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardImage" "$ref": "#/definitions/CardImage"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Set of actions applicable to the current card", "description": "Set of actions applicable to the current card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"tap": { "tap": {
"$ref": "#/definitions/CardAction", "$ref": "#/definitions/CardAction",
@ -1569,14 +1586,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MediaUrl" "$ref": "#/definitions/MediaUrl"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Actions on this card", "description": "Actions on this card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"shareable": { "shareable": {
"description": "This content may be shared with others (default:true)", "description": "This content may be shared with others (default:true)",
@ -1657,14 +1676,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MediaUrl" "$ref": "#/definitions/MediaUrl"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Actions on this card", "description": "Actions on this card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"shareable": { "shareable": {
"description": "This content may be shared with others (default:true)", "description": "This content may be shared with others (default:true)",
@ -1713,14 +1734,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardImage" "$ref": "#/definitions/CardImage"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Set of actions applicable to the current card", "description": "Set of actions applicable to the current card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"tap": { "tap": {
"$ref": "#/definitions/CardAction", "$ref": "#/definitions/CardAction",
@ -1753,14 +1776,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MediaUrl" "$ref": "#/definitions/MediaUrl"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Actions on this card", "description": "Actions on this card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"shareable": { "shareable": {
"description": "This content may be shared with others (default:true)", "description": "This content may be shared with others (default:true)",
@ -1801,14 +1826,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/Fact" "$ref": "#/definitions/Fact"
} },
"x-omitempty": true
}, },
"items": { "items": {
"description": "Array of Receipt Items", "description": "Array of Receipt Items",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/ReceiptItem" "$ref": "#/definitions/ReceiptItem"
} },
"x-omitempty": true
}, },
"tap": { "tap": {
"$ref": "#/definitions/CardAction", "$ref": "#/definitions/CardAction",
@ -1831,7 +1858,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
} }
} }
}, },
@ -1896,7 +1924,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
} }
} }
}, },
@ -1921,7 +1950,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
} }
} }
}, },
@ -1964,14 +1994,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardImage" "$ref": "#/definitions/CardImage"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Set of actions applicable to the current card", "description": "Set of actions applicable to the current card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"tap": { "tap": {
"$ref": "#/definitions/CardAction", "$ref": "#/definitions/CardAction",
@ -2004,14 +2036,16 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/MediaUrl" "$ref": "#/definitions/MediaUrl"
} },
"x-omitempty": true
}, },
"buttons": { "buttons": {
"description": "Actions on this card", "description": "Actions on this card",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/CardAction" "$ref": "#/definitions/CardAction"
} },
"x-omitempty": true
}, },
"shareable": { "shareable": {
"description": "This content may be shared with others (default:true)", "description": "This content may be shared with others (default:true)",
@ -2195,7 +2229,8 @@
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/Activity" "$ref": "#/definitions/Activity"
} },
"x-omitempty": true
} }
} }
}, },