Skip to content

Commit d1a2d56

Browse files
committed
Merge branch 'main' of https://github.com/Sideko-Inc/sideko
2 parents b88f7eb + 7754b44 commit d1a2d56

12 files changed

Lines changed: 187 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 116 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["sideko", "docs"]
2+
members = ["sideko", "docs", "sideko-py"]
33
resolver = "2"
44

55
# The profile that 'dist' will build with

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ curl -fsSL https://raw.githubusercontent.com/Sideko-Inc/sideko/main/install.sh |
3939

4040
## Quickstart - Premium SDKs in Seconds
4141
```bash
42-
# authenticate
42+
# authenticate (uses native keychain to store credentials on host)
4343
sideko login
4444

4545
# interactively create sdks

docs/CLI.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ create a new version of an api with an openapi spec
120120
* `--name <NAME>` — api name or id e.g. my-api
121121
* `--version <VERSION>` — semantic version (e.g. `2.1.5`) or version bump (`patch`, `minor`, `major`, `rc`)
122122
* `--spec <SPEC>` — path to openapi specification (YAML or JSON format)
123+
* `--allow-lint-errors` — Allow linting errors to be present in the provided spec [default: false]
124+
125+
By default creating a new version with an OpenAPI that contains linting errors is disallowed. If you wish to allow linting errors you may experience issues later with SDK generation or mock servers.
123126
* `--disable-mock` — disable mock server for new version [default: enabled]
124127
* `--display <DISPLAY>` — display result as a raw json or prettified
125128

@@ -161,6 +164,9 @@ updates an existing api version
161164
* `--version <VERSION>` — version to update (e.g. `2.1.5` or `latest`)
162165
* `--new-version <NEW_VERSION>` — version to update with (e.g. `2.1.5`)
163166
* `--spec <SPEC>` — path to openapi spec (yaml or json format) to update with
167+
* `--allow-lint-errors` — Allow linting errors to be present in the provided spec [default: false]
168+
169+
By default using an OpenAPI that contains linting errors is disallowed. If you wish to allow linting errors you may experience issues later with SDK generation or mock servers.
164170
* `--mock <MOCK>` — enable or disable the mock server
165171

166172
Possible values: `true`, `false`
@@ -199,6 +205,9 @@ create a new api
199205
* `--name <NAME>` — name of api (only alphanumeric characters and dashes, e.g. `my-api`)
200206
* `--version <VERSION>` — semantic version of initial version (e.g. `0.1.0`)
201207
* `--spec <SPEC>` — path to openapi spec of initial version (yaml or json format)
208+
* `--allow-lint-errors` — Allow linting errors to be present in the provided spec [default: false]
209+
210+
By default using an OpenAPI that contains linting errors is disallowed. If you wish to allow linting errors you may experience issues later with SDK generation or mock servers.
202211
* `--disable-mock` — disable mock server for initial version [default: enabled]
203212
* `--display <DISPLAY>` — display result as a raw json or prettified
204213

@@ -260,6 +269,7 @@ linting errors gathered from the specification
260269
* `--version <VERSION>` — API version e.g. v1, latest
261270

262271
Default value: `latest`
272+
* `--errors` — Show errors only
263273
* `--display <DISPLAY>` — display result as a raw json or prettified
264274

265275
Default value: `pretty`

release.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,18 @@ def main():
192192
)
193193
parser.add_argument(
194194
"--version",
195+
required=True,
195196
help="Version to release (if not provided, will use current version)",
196197
)
197198
args = parser.parse_args()
198199

199-
current_version = get_current_version()
200-
if not args.version:
201-
raise Exception(f"Must specify version. Current is: {current_version}")
200+
# Confirm there are no rust compile-time issues
201+
run_command("cargo check", check=True)
202+
203+
# Confirm `gh` CLI is installed & authenticated
204+
run_command("gh auth status", check=True)
202205

206+
current_version = get_current_version()
203207
version = args.version
204208
print(f"\nBumping version from {current_version} to {version}")
205209

@@ -245,10 +249,11 @@ def main():
245249
# 3. Restore sideko-py
246250
print("\nStep 3: Restoring sideko-py to workspace...")
247251
update_workspace_toml(delete=False)
248-
show_git_diff([Path("Cargo.toml")])
252+
run_command("cargo check", check=True) # run cargo check to update lockfile
253+
show_git_diff([Path("Cargo.toml"), Path("Cargo.lock")])
249254
if not confirm_action("Does this look correct?"):
250255
print("Aborting on user request")
251-
run_command("git restore Cargo.toml")
256+
run_command("git restore Cargo.toml Cargo.lock")
252257
sys.exit(1)
253258

254259
# 4. Push changes
@@ -265,10 +270,11 @@ def main():
265270
# 6. Remove sideko-py again
266271
print("\nStep 6: Removing sideko-py from workspace...")
267272
update_workspace_toml(delete=True)
268-
show_git_diff([Path("Cargo.toml")])
273+
run_command("cargo check", check=True) # run cargo check to update lockfile
274+
show_git_diff([Path("Cargo.toml"), Path("Cargo.lock")])
269275
if not confirm_action("Does this look correct?"):
270276
print("Aborting on user request")
271-
run_command("git restore Cargo.toml")
277+
run_command("git restore Cargo.toml Cargo.lock")
272278
sys.exit(1)
273279

274280
# 7. Final push

sideko-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sideko-py"
33
description = "Generate & manage SDKs with the Sideko CLI"
4-
version = "1.1.0"
4+
version = "1.1.1"
55
edition = "2021"
66
authors = [
77
"Elias Posen <elias@sideko.dev>",

sideko/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sideko"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2021"
55
authors = [
66
"Elias Posen <elias@sideko.dev>",
@@ -32,7 +32,7 @@ tar = "0.4.40"
3232
tokio = { version = "1.35.1", features = ["time"] }
3333
url = "2.4.1"
3434
semver = "1.0.23"
35-
sideko_rest_api = "0.5.1"
35+
sideko_rest_api = "0.5.2"
3636
tempfile = "3.12.0"
3737
dotenvy = "0.15.7"
3838
tabled = "0.18.0"

sideko/src/cmds/api/create.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ pub struct ApiCreateCommand {
2727
)]
2828
pub spec: Utf8PathBuf,
2929

30+
/// Allow linting errors to be present in the provided spec [default: false]
31+
///
32+
/// By default using an OpenAPI that contains linting errors is disallowed.
33+
/// If you wish to allow linting errors you may experience issues later with SDK generation or mock servers.
34+
#[arg(long)]
35+
pub allow_lint_errors: bool,
36+
3037
/// disable mock server for initial version [default: enabled]
3138
#[arg(long)]
3239
pub disable_mock: bool,
@@ -50,6 +57,7 @@ impl ApiCreateCommand {
5057
)
5158
})?,
5259
version: VersionOrBump::Str(self.version.clone()),
60+
allow_lint_errors: Some(self.allow_lint_errors),
5361
..Default::default()
5462
})
5563
.await?;

sideko/src/cmds/api/lint.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ pub struct LintCommand {
3030
#[arg(long, default_value = "latest")]
3131
pub version: Option<String>,
3232

33+
/// Show errors only
34+
#[arg(long)]
35+
pub errors: bool,
36+
3337
/// display result as a raw json or prettified
3438
#[arg(long, default_value = "pretty")]
3539
pub display: DisplayOutput,
@@ -75,9 +79,13 @@ impl LintCommand {
7579
DisplayOutput::Pretty => {
7680
let filename =
7781
if let Some(Some(filename)) = self.spec.as_ref().map(|p| p.file_name()) {
78-
filename
82+
filename.to_string()
7983
} else {
80-
"openapi"
84+
format!(
85+
"{name}-{version}-openapi",
86+
name = self.name.clone().unwrap_or_default(),
87+
version = self.version.clone().unwrap_or_default()
88+
)
8189
};
8290

8391
// build summary table
@@ -136,10 +144,14 @@ impl LintCommand {
136144
// display full results table
137145
if !report.results.is_empty() {
138146
let mut report_table =
139-
tabled::Table::new(report.results.into_iter().map(|result| {
140-
TabledLintResult {
141-
filename: filename.to_string(),
142-
result,
147+
tabled::Table::new(report.results.into_iter().filter_map(|result| {
148+
if !self.errors || matches!(&result.severity, LintSeverityEnum::Error) {
149+
Some(TabledLintResult {
150+
filename: filename.to_string(),
151+
result,
152+
})
153+
} else {
154+
None
143155
}
144156
}));
145157
utils::tabled::header_panel(

0 commit comments

Comments
 (0)