diff --git a/crates/cli/src/subcommands/describe.rs b/crates/cli/src/subcommands/describe.rs index f81ed164c0..4d53a2f034 100644 --- a/crates/cli/src/subcommands/describe.rs +++ b/crates/cli/src/subcommands/describe.rs @@ -1,7 +1,7 @@ use crate::common_args; use crate::config::Config; use crate::util::{add_auth_header_opt, database_address, get_auth_header_only}; -use clap::{Arg, ArgAction::SetTrue, ArgMatches}; +use clap::{Arg, ArgMatches}; pub fn cli() -> clap::Command { clap::Command::new("describe") @@ -21,8 +21,6 @@ pub fn cli() -> clap::Command { .requires("entity_type") .help("The name of the entity to describe"), ) - .arg(Arg::new("brief").long("brief").short('b').action(SetTrue) - .help("If this flag is present, a brief description shall be returned")) .arg( common_args::identity() .conflicts_with("anon_identity") @@ -41,7 +39,6 @@ pub fn cli() -> clap::Command { pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> { let database = args.get_one::("database").unwrap(); - let expand = !args.get_flag("brief"); let entity_name = args.get_one::("entity_name"); let entity_type = args.get_one::("entity_type"); let server = args.get_one::("server").map(|s| s.as_ref()); @@ -64,13 +61,7 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E let auth_header = get_auth_header_only(&mut config, anon_identity, identity, server).await?; let builder = add_auth_header_opt(builder, &auth_header); - let descr = builder - .query(&[("expand", expand)]) - .send() - .await? - .error_for_status()? - .text() - .await?; + let descr = builder.send().await?.error_for_status()?.text().await?; println!("{}", descr); Ok(()) diff --git a/crates/client-api/src/routes/database.rs b/crates/client-api/src/routes/database.rs index c71df040e0..0e2405325e 100644 --- a/crates/client-api/src/routes/database.rs +++ b/crates/client-api/src/routes/database.rs @@ -222,7 +222,7 @@ impl<'a> EntityDef<'a> { } } -fn entity_description_json(description: WithTypespace, expand: bool) -> Option { +fn entity_description_json(description: WithTypespace) -> Option { let typ = description.ty().described_entity_ty().as_str(); let len = match description.ty() { EntityDef::Table(t) => description @@ -233,32 +233,25 @@ fn entity_description_json(description: WithTypespace, expand: bool) .len(), EntityDef::Reducer(r) => r.params.elements.len(), }; - if expand { - // TODO(noa): make this less hacky; needs coordination w/ spacetime-web - let schema = match description.ty() { - EntityDef::Table(table) => { - json!(description - .with(&table.product_type_ref) - .resolve_refs() - .ok()? - .as_product()?) - } - EntityDef::Reducer(r) => json!({ - "name": &r.name[..], - "elements": r.params.elements, - }), - }; - Some(json!({ - "type": typ, - "arity": len, - "schema": schema - })) - } else { - Some(json!({ - "type": typ, - "arity": len, - })) - } + // TODO(noa): make this less hacky; needs coordination w/ spacetime-web + let schema = match description.ty() { + EntityDef::Table(table) => { + json!(description + .with(&table.product_type_ref) + .resolve_refs() + .ok()? + .as_product()?) + } + EntityDef::Reducer(r) => json!({ + "name": &r.name[..], + "elements": r.params.elements, + }), + }; + Some(json!({ + "type": typ, + "arity": len, + "schema": schema + })) } #[derive(Deserialize)] @@ -268,11 +261,6 @@ pub struct DescribeParams { entity: String, } -#[derive(Deserialize)] -pub struct DescribeQueryParams { - expand: Option, -} - pub async fn describe( State(worker_ctx): State, Path(DescribeParams { @@ -280,7 +268,6 @@ pub async fn describe( entity_type, entity, }): Path, - Query(DescribeQueryParams { expand }): Query, Extension(auth): Extension, ) -> axum::response::Result where @@ -311,8 +298,7 @@ where .ok_or_else(|| (StatusCode::NOT_FOUND, format!("{entity_type} {entity:?} not found")))?; let description = WithTypespace::new(module.info().module_def.typespace(), &description); - let expand = expand.unwrap_or(true); - let response_json = json!({ entity: entity_description_json(description, expand) }); + let response_json = json!({ entity: entity_description_json(description) }); Ok(( StatusCode::OK, @@ -343,26 +329,18 @@ pub struct CatalogParams { } #[derive(Deserialize)] pub struct CatalogQueryParams { - expand: Option, #[serde(default)] module_def: bool, } pub async fn catalog( State(worker_ctx): State, Path(CatalogParams { name_or_address }): Path, - Query(CatalogQueryParams { expand, module_def }): Query, + Query(CatalogQueryParams { module_def }): Query, Extension(auth): Extension, ) -> axum::response::Result where S: ControlStateDelegate + NodeDelegate, { - if module_def && expand.is_some() { - return Err(( - StatusCode::BAD_REQUEST, - "expand and module_def cannot both be specified", - ) - .into()); - } let address = name_or_address.resolve(&worker_ctx).await?.into(); let database = worker_ctx_find_database(&worker_ctx, &address) .await? @@ -381,15 +359,11 @@ where let raw = RawModuleDefV9::from(module.info().module_def.clone()); serde_json::to_value(SerializeWrapper::from_ref(&raw)).map_err(log_and_500)? } else { - let expand = expand.unwrap_or(false); let response_catalog: HashMap<_, _> = get_catalog(&module) .map(|entity| { ( entity.name().to_string().into_boxed_str(), - entity_description_json( - WithTypespace::new(module.info().module_def.typespace(), &entity), - expand, - ), + entity_description_json(WithTypespace::new(module.info().module_def.typespace(), &entity)), ) }) .collect();