fix(codegen): fixed nested all_of

This commit is contained in:
pyrite 2025-12-03 13:55:15 +01:00
parent 2e60e0a24f
commit 06c766b7ec
Signed by: pyrite
GPG key ID: 7F1BA9170CD35D15
7 changed files with 265 additions and 81 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "torn-api"
version = "4.7.0"
version = "5.0.2"
edition = "2021"
description = "Auto-generated bindings for the v2 torn api"
license = { workspace = true }
@ -43,7 +43,7 @@ strum = { version = "0.27.1", features = ["derive"], optional = true }
tokio = { version = "1", features = ["full"] }
[build-dependencies]
torn-api-codegen = { path = "../torn-api-codegen", version = "0.8" }
torn-api-codegen = { path = "../torn-api-codegen", version = "0.8.1" }
syn = { workspace = true, features = ["parsing"] }
proc-macro2 = { workspace = true }
prettyplease = "0.2"

View file

@ -3,7 +3,7 @@
"info": {
"title": "Torn API",
"description": "\n * The development of Torn's API v2 is still ongoing.\n * If selections remain unaltered, they will default to the API v1 version.\n * Unlike API v1, API v2 accepts both selections and IDs as path and query parameters.\n * If any discrepancies or errors are found, please submit a [bug report](https://www.torn.com/forums.php#/p=forums&f=19&b=0&a=0) on the Torn Forums.\n * In case you're using bots to check for changes on openapi.json file, make sure to specificy a custom user-agent header - CloudFlare sometimes prevents requests from default user-agents.",
"version": "4.6.0"
"version": "5.0.2"
},
"servers": [
{
@ -422,7 +422,7 @@
"tags": [
"User"
],
"summary": "Get your competition's event start time",
"summary": "Get your calendar events start time",
"description": "Requires minimal access key. <br>Only available to yourself.",
"operationId": "4cc4cc6fa3764f9732db9589e91d7739",
"parameters": [
@ -795,6 +795,45 @@
"x-stability": "Stable"
}
},
"/user/equipment": {
"get": {
"tags": [
"User"
],
"summary": "Get your equipment & clothing",
"description": "Requires minimal access key.",
"operationId": "273c3a96077332793a1b6ffe21c10218",
"parameters": [
{
"$ref": "#/components/parameters/ApiTimestamp"
},
{
"$ref": "#/components/parameters/ApiComment"
},
{
"$ref": "#/components/parameters/ApiKeyMinimal"
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserEquipmentResponse"
}
}
}
}
},
"security": [
{
"api_key": []
}
],
"x-stability": "Unstable"
}
},
"/user/events": {
"get": {
"tags": [
@ -933,46 +972,6 @@
"x-stability": "Stable"
}
},
"/user/factionbalance": {
"get": {
"tags": [
"User"
],
"summary": "Deprecated. Use user/money instead",
"description": "Will be removed on 1st of December 2025. Requires limited access key. <br>",
"operationId": "b7ebbeea51dc2ef56c3ed5fd9d94e680",
"parameters": [
{
"$ref": "#/components/parameters/ApiTimestamp"
},
{
"$ref": "#/components/parameters/ApiComment"
},
{
"$ref": "#/components/parameters/ApiKeyLimited"
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserFactionBalanceResponse"
}
}
}
}
},
"deprecated": true,
"security": [
{
"api_key": []
}
],
"x-stability": "Deprecated"
}
},
"/user/forumfeed": {
"get": {
"tags": [
@ -3427,6 +3426,12 @@
{
"$ref": "#/components/schemas/UserForumFriendsResponse"
},
{
"$ref": "#/components/schemas/UserPropertyResponse"
},
{
"$ref": "#/components/schemas/ReportsResponse"
},
{
"$ref": "#/components/schemas/UserHofResponse"
},
@ -3490,6 +3495,9 @@
{
"$ref": "#/components/schemas/UserListResponse"
},
{
"$ref": "#/components/schemas/UserEquipmentResponse"
},
{
"$ref": "#/components/schemas/UserMissionsResponse"
},
@ -8358,6 +8366,54 @@
"x-stability": "Stable"
}
},
"/torn/{id}/itemdetails": {
"get": {
"tags": [
"Torn"
],
"summary": "Get information about a specific item",
"description": "Requires public key.",
"operationId": "bb6524988f52a1e75729c05a825b91c8",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Item uid",
"required": true,
"schema": {
"$ref": "#/components/schemas/ItemUid"
}
},
{
"$ref": "#/components/parameters/ApiTimestamp"
},
{
"$ref": "#/components/parameters/ApiComment"
},
{
"$ref": "#/components/parameters/ApiKeyPublic"
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TornItemDetailsResponse"
}
}
}
}
},
"security": [
{
"api_key": []
}
],
"x-stability": "Unstable"
}
},
"/torn/itemmods": {
"get": {
"tags": [
@ -9060,6 +9116,9 @@
{
"$ref": "#/components/schemas/TornCrimeId"
},
{
"$ref": "#/components/schemas/ItemUid"
},
{
"type": "array",
"items": {
@ -9185,9 +9244,15 @@
{
"$ref": "#/components/schemas/TornMeritsResponse"
},
{
"$ref": "#/components/schemas/TornOrganizedCrimeResponse"
},
{
"$ref": "#/components/schemas/TornHonorsResponse"
},
{
"$ref": "#/components/schemas/TornItemDetailsResponse"
},
{
"$ref": "#/components/schemas/TornMedalsResponse"
},
@ -13753,7 +13818,6 @@
"Newsletter Sending",
"Announcement Changes",
"Description Changes",
"Organised Crimes",
"Utility Item Loaning",
"Consumable Item Usage"
]
@ -15813,6 +15877,69 @@
}
]
},
"UserEquipment": {
"allOf": [
{
"$ref": "#/components/schemas/TornItemDetails"
},
{
"required": [
"slot"
],
"properties": {
"slot": {
"type": "integer",
"format": "int32"
}
},
"type": "object"
}
]
},
"UserClothing": {
"required": [
"id",
"name",
"uid",
"type"
],
"properties": {
"id": {
"$ref": "#/components/schemas/ItemId"
},
"name": {
"type": "string"
},
"uid": {
"$ref": "#/components/schemas/ItemUid"
},
"type": {
"$ref": "#/components/schemas/TornItemTypeEnum"
}
},
"type": "object"
},
"UserEquipmentResponse": {
"required": [
"equipment",
"clothing"
],
"properties": {
"equipment": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserEquipment"
}
},
"clothing": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserClothing"
}
}
},
"type": "object"
},
"UserDiscordResponse": {
"required": [
"discord"
@ -16321,11 +16448,7 @@
"UserBar": {
"required": [
"current",
"maximum",
"increment",
"interval",
"tick_time",
"full_time"
"maximum"
],
"properties": {
"current": {
@ -16335,22 +16458,6 @@
"maximum": {
"type": "integer",
"format": "int32"
},
"increment": {
"type": "integer",
"format": "int32"
},
"interval": {
"type": "integer",
"format": "int32"
},
"tick_time": {
"type": "integer",
"format": "int32"
},
"full_time": {
"type": "integer",
"format": "int32"
}
},
"type": "object"
@ -16648,6 +16755,33 @@
},
"type": "object"
},
"UserCompetitionElimination": {
"required": [
"name",
"score",
"total"
],
"properties": {
"name": {
"type": "string",
"enum": [
"Elimination"
]
},
"score": {
"type": "integer",
"format": "int32"
},
"team": {
"type": "string"
},
"attacks": {
"type": "integer",
"format": "int32"
}
},
"type": "object"
},
"UserCompetitionRps": {
"required": [
"name",
@ -16699,6 +16833,9 @@
},
{
"$ref": "#/components/schemas/UserCompetitionRps"
},
{
"$ref": "#/components/schemas/UserCompetitionElimination"
}
]
}
@ -19374,7 +19511,7 @@
"UserSelectionName": {
"oneOf": [
{
"description": "The following selections will fallback to API v1 and may change at any time: 'bazaar','criminalrecord','display','equipment','gym','inventory','networth','perks','stocks'.",
"description": "The following selections will fallback to API v1 and may change at any time: 'bazaar','criminalrecord','display','gym','inventory','networth','perks','stocks'.",
"type": "string",
"enum": [
"ammo",
@ -19390,6 +19527,7 @@
"crimes",
"discord",
"enlistedcars",
"equipment",
"events",
"faction",
"factionbalance",
@ -19436,7 +19574,6 @@
"criminalrecord",
"display",
"education",
"equipment",
"gym",
"inventory",
"networth",
@ -23926,11 +24063,6 @@
}
]
},
"travel_type": {
"description": "This field is replaced by the 'plane_image_type' field and will be removed on October 1st 2025.",
"type": "string",
"deprecated": true
},
"plane_image_type": {
"$ref": "#/components/schemas/UserPlaneImageTypeEnum",
"description": "This field is populated only if the state is 'Traveling'."
@ -27871,6 +28003,54 @@
},
"type": "object"
},
"TornItemDetails": {
"allOf": [
{
"$ref": "#/components/schemas/ItemMarketListingItemDetails"
},
{
"required": [
"id",
"name",
"type",
"sub_type"
],
"properties": {
"id": {
"$ref": "#/components/schemas/ItemId"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/TornItemTypeEnum"
},
"sub_type": {
"oneOf": [
{
"$ref": "#/components/schemas/TornItemWeaponTypeEnum"
},
{
"type": "null"
}
]
}
},
"type": "object"
}
]
},
"TornItemDetailsResponse": {
"required": [
"itemdetails"
],
"properties": {
"itemdetails": {
"$ref": "#/components/schemas/TornItemDetails"
}
},
"type": "object"
},
"TornMerit": {
"required": [
"id",

View file

@ -777,7 +777,7 @@ pub(super) mod test {
async fn user_factionbalance() {
let client = test_client().await;
client.user().factionbalance(|b| b).await.unwrap();
client.user().money(|b| b).await.unwrap();
}
#[tokio::test]