Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always fmt and sort after generating sdk #1

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ env:
CARGO_TERM_COLOR: always

jobs:
# Do not change this job's name without also changing "pr-ready"'s
# job name in "on-merge.yml". These jobs must have the same name.
# See the README for more details.
pr-ready:
if: always()
name: "⚡ PR Ready"
runs-on: ubuntu-22.04
needs:
- "build"
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
run: |
echo "One or more dependent jobs failed, was skipped, or was cancelled. All jobs must pass for the PR to be ready."
exit 1
- run: echo "OK"
# This job installs Cargo Make and Cargo Nextest before running
# the CI workflow using Cargo Make. Most of the time, it should
# restore Cargo Make and other dependencies from cache.
Expand Down
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
7.11.0
22 changes: 12 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
[package]
name = "openapi"
name = "multitool-sdk"
version = "0.1.0"
authors = ["OpenAPI Generator team and contributors"]
description = "MultiTool backend API"
license = "All Rights Reserved"
edition = "2018"
edition = "2021"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
async-trait = "^0.1"
mockall = { version = "^0.13", optional = true }
reqwest = { version = "^0.12", features = ["json", "multipart"] }
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
serde_with = "^2.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]
serde_repr = "^0.1"
serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
[features]
mockall = ["dep:mockall"]
20 changes: 19 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,30 @@ alias = "generate"

[tasks.generate]
description = "Generate the Rust SDK from the API spec."
dependencies = [
"generate-sdk",
"sort",
"format-flow",
"clippy-flow",
]


# TODO: Consider piping in the package version from Cargo.toml
# if the generator is producing the wrong library version.
[tasks.generate-sdk]
description = "Generate the SDK. Does not fmt or sort the output. Use `cargo make generate` instead."
private = true
script = [
'''
docker run --rm -v "$PWD:/local" \
openapitools/openapi-generator-cli:v7.4.0 generate \
openapitools/openapi-generator-cli:v7.11.0 generate \
-i /local/openapi.json \
-g rust \
--additional-properties library=reqwest-trait \
--additional-properties mockall=true \
--additional-properties packageName=multitool-sdk \
--additional-properties preferUnsignedInt=true \
-o /local/

'''
]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rust API client for openapi
# Rust API client for multitool-sdk

MultiTool backend API

Expand All @@ -9,15 +9,15 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat

- API version: 0.1.0
- Package version: 0.1.0
- Generator version: 7.4.0
- Generator version: 7.11.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`

## Installation

Put the package under your project folder in a directory named `openapi` and add the following to `Cargo.toml` under `[dependencies]`:
Put the package under your project folder in a directory named `multitool-sdk` and add the following to `Cargo.toml` under `[dependencies]`:

```
openapi = { path = "./openapi" }
multitool-sdk = { path = "./multitool-sdk" }
```

## Documentation for API Endpoints
Expand Down
2 changes: 1 addition & 1 deletion docs/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Name | Type | Description | Notes
**app_id** | [**uuid::Uuid**](uuid::Uuid.md) | |
**created_at** | **String** | |
**events** | [**Vec<models::DeploymentEvent>**](DeploymentEvent.md) | |
**id** | **i64** | |
**id** | **u64** | |
**status** | [**models::DeploymentStatus**](DeploymentStatus.md) | |
**updated_at** | **String** | |

Expand Down
2 changes: 1 addition & 1 deletion docs/DeploymentEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**created_at** | **String** | |
**event_type** | [**models::DeploymentEventType**](DeploymentEventType.md) | |
**id** | **i64** | |
**id** | **u64** | |
**updated_at** | **String** | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/DeploymentsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**workspace_id** | **uuid::Uuid** | The workspace's id | [required] |
**application_id** | **uuid::Uuid** | The application's id | [required] |
**deployment_id** | **i64** | The deployment's id | [required] |
**deployment_id** | **u64** | The deployment's id | [required] |

### Return type

Expand Down
2 changes: 1 addition & 1 deletion docs/ResponseCodeMetrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**app_class** | [**models::ApplicationGroup**](ApplicationGroup.md) | |
**created_at** | **String** | |
**deployment_id** | **i64** | |
**deployment_id** | **u64** | |
**status_2xx_count** | **i32** | |
**status_4xx_count** | **i32** | |
**status_5xx_count** | **i32** | |
Expand Down
2 changes: 1 addition & 1 deletion docs/ResponseCodeMetricsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**workspace_id** | **uuid::Uuid** | The workspace's id | [required] |
**application_id** | **uuid::Uuid** | The application's id | [required] |
**deployment_id** | **i64** | The deployment's id | [required] |
**deployment_id** | **u64** | The deployment's id | [required] |
**create_response_code_metrics_request** | [**CreateResponseCodeMetricsRequest**](CreateResponseCodeMetricsRequest.md) | | [required] |

### Return type
Expand Down
Loading