Skip to content

Commit

Permalink
Update dropshot and openapiv3 deps
Browse files Browse the repository at this point in the history
The json specification generated by the updated openapiv3 is ordered
slightly differently, but not in a way that matters to anything but
"brute force" diff checks like expectorate.  This updates the dependency
and applies the reordering to the recorded OpenAPI specs.
  • Loading branch information
pfmooney committed Nov 13, 2023
1 parent e2fa996 commit 3364580
Show file tree
Hide file tree
Showing 14 changed files with 186 additions and 159 deletions.
60 changes: 35 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions internal-dns/tests/output/test-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
}
},
"components": {
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"schemas": {
"Error": {
"description": "Error information from a response.",
Expand All @@ -65,6 +53,18 @@
"request_id"
]
}
},
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
20 changes: 16 additions & 4 deletions nexus/src/bin/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct Args {
short = 'O',
long = "openapi",
help = "Print the external OpenAPI Spec document and exit",
conflicts_with = "openapi_internal",
action
)]
openapi: bool,
Expand All @@ -40,7 +41,7 @@ struct Args {
openapi_internal: bool,

#[clap(name = "CONFIG_FILE_PATH", action)]
config_file_path: PathBuf,
config_file_path: Option<PathBuf>,
}

#[tokio::main]
Expand All @@ -53,14 +54,25 @@ async fn main() {
async fn do_run() -> Result<(), CmdError> {
let args = Args::parse();

let config = Config::from_file(args.config_file_path)
.map_err(|e| CmdError::Failure(anyhow!(e)))?;

if args.openapi {
run_openapi_external().map_err(|err| CmdError::Failure(anyhow!(err)))
} else if args.openapi_internal {
run_openapi_internal().map_err(|err| CmdError::Failure(anyhow!(err)))
} else {
let config_path = match args.config_file_path {
Some(path) => path,
None => {
use clap::CommandFactory;

eprintln!("{}", Args::command().render_help());
return Err(CmdError::Usage(
"CONFIG_FILE_PATH is required".to_string(),
));
}
};
let config = Config::from_file(config_path)
.map_err(|e| CmdError::Failure(anyhow!(e)))?;

run_server(&config).await.map_err(|err| CmdError::Failure(anyhow!(err)))
}
}
15 changes: 11 additions & 4 deletions nexus/tests/output/cmd-nexus-noargs-stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
error: the following required arguments were not provided:
<CONFIG_FILE_PATH>
See README.adoc for more information

Usage: nexus <CONFIG_FILE_PATH>
Usage: nexus [OPTIONS] [CONFIG_FILE_PATH]

For more information, try '--help'.
Arguments:
[CONFIG_FILE_PATH]

Options:
-O, --openapi Print the external OpenAPI Spec document and exit
-I, --openapi-internal Print the internal OpenAPI Spec document and exit
-h, --help Print help

nexus: CONFIG_FILE_PATH is required
24 changes: 12 additions & 12 deletions openapi/bootstrap-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,6 @@
}
},
"components": {
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"schemas": {
"Baseboard": {
"description": "Describes properties that should uniquely identify a Gimlet.",
Expand Down Expand Up @@ -977,6 +965,18 @@
"description": "Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.",
"type": "string"
}
},
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
24 changes: 12 additions & 12 deletions openapi/dns-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@
}
},
"components": {
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"schemas": {
"DnsConfig": {
"type": "object",
Expand Down Expand Up @@ -251,6 +239,18 @@
"weight"
]
}
},
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
Loading

0 comments on commit 3364580

Please sign in to comment.