Skip to content
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
72 changes: 72 additions & 0 deletions .github/workflows/samples-rust-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Samples Rust Clients

on:
push:
paths:
- "samples/client/others/rust/**"
- "samples/client/petstore/rust-server/**"
pull_request:
paths:
- "samples/client/others/rust/**"
- "samples/client/petstore/rust/**"

jobs:
build:
name: Build Rust
runs-on: ubuntu-latest
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
strategy:
fail-fast: false
matrix:
sample:
# these folders contain sub-projects of rust clients, servers
- samples/client/others/rust/
- samples/client/petstore/rust/
steps:
- uses: actions/checkout@v5
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: false # Don't cache workspace target directories as they don't exist
cache-directories:
${{ matrix.sample }}/target
workspaces: |
${{ matrix.sample }}/output/*

- name: Build
working-directory: ${{ matrix.sample }}
run: cargo build --all-targets --all-features
- name: Tests
working-directory: ${{ matrix.sample }}
run: |
set -e

# Iterate through each example and test various features
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
do
# Not all versions have a client example
if test -f examples/client/main.rs; then
cargo build --example client --features="client"
fi

# Test the CLI works if present
if test -f bin/cli.rs; then
cargo build --bin ${package##*/} --features cli
target/debug/${package##*/} --help
fi
cargo fmt
cargo test
cargo clippy
cargo doc
done
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Samples Rust
name: Samples Rust Servers

on:
push:
paths:
- "samples/client/others/rust/**"
- "samples/server/petstore/rust-server/**"
- "samples/client/petstore/rust-server/**"
- "samples/server/petstore/rust-axum/**"
pull_request:
paths:
- "samples/client/others/rust/**"
- "samples/client/petstore/rust/**"
- "samples/server/petstore/rust-server/**"
- "samples/server/petstore/rust-axum/**"

Expand All @@ -23,8 +19,6 @@ jobs:
matrix:
sample:
# these folders contain sub-projects of rust clients, servers
- samples/client/others/rust/
- samples/client/petstore/rust/
- samples/server/petstore/rust-server/
- samples/server/petstore/rust-server-deprecated/
- samples/server/petstore/rust-axum/
Expand All @@ -50,19 +44,10 @@ jobs:
working-directory: ${{ matrix.sample }}
run: |
set -e
# Skip samples/client/petstore/rust/ as its tests are failing.
if [[ "${{ matrix.sample }}" == "samples/client/petstore/rust/" ]]; then
echo "Skipping tests for samples/client/petstore/rust/"
exit 0
fi

# Iterate through each example and test various features
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
do
# Not all versions have a client example
if test -f examples/client/main.rs; then
cargo build --example client --features="client"
fi
# Not all versions have a server example
if test -f examples/server/main.rs; then
cargo build --example server --features="server"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
- url: 'http://localhost/v2'
info:
description: >-
This is a sample server Petstore server. For this sample, you can use the api key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
#
#
#
2 changes: 1 addition & 1 deletion samples/client/petstore/rust/hyper/petstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ petstore-hyper = { path = "./petstore-hyper" }

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \FakeApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/rust/hyper/petstore/docs/PetApi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \PetApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \StoreApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \TestingApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \UserApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<C: Connect> Configuration<C>
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
base_path: "http://localhost/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
client,
basic_auth: None,
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/rust/hyper0x/petstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ petstore-hyper0x = { path = "./petstore-hyper0x" }

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \FakeApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \PetApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \StoreApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \TestingApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \UserApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
base_path: "http://localhost/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
client,
basic_auth: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ petstore-reqwest-trait = { path = "./petstore-reqwest-trait" }

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \FakeApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \PetApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \StoreApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \TestingApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \UserApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Configuration {
impl Default for Configuration {
fn default() -> Self {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
base_path: "http://localhost/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
client: reqwest::Client::new(),
basic_auth: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ petstore-reqwest-async-middleware = { path = "./petstore-reqwest-async-middlewar

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \FakeApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \PetApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \StoreApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \TestingApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \UserApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Configuration {
impl Default for Configuration {
fn default() -> Self {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
base_path: "http://localhost/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
client: reqwest_middleware::ClientBuilder::new(reqwest::Client::new()).build(),
basic_auth: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ petstore-reqwest-async-tokensource = { path = "./petstore-reqwest-async-tokensou

## Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \FakeApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \PetApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# \StoreApi

All URIs are relative to *http://petstore.swagger.io/v2*
All URIs are relative to *http://localhost/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
Expand Down
Loading
Loading