Skip to content

Commit

Permalink
Only remove prefixes from path when determining the name
Browse files Browse the repository at this point in the history
Turned out the prefix was removed for the path as a whole.
  • Loading branch information
oeb25 committed Sep 27, 2023
1 parent aed7952 commit c738cb6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ impl Operation {
#[tracing::instrument(skip_all)]
fn ts(&self, db: &dyn crate::Db, api: InputApi, method: &str) -> (String, String) {
let path = Utf8PathBuf::from(&self.path);
let path = if let Some(prefix) = api.config(db).api_prefix {
path.strip_prefix(prefix).unwrap().to_owned()
let name = if let Some(prefix) = api.config(db).api_prefix {
path.strip_prefix(prefix).unwrap()
} else {
path
};
let name = path.components().join("_").to_lower_camel_case();
&path
}
.components()
.join("_")
.to_lower_camel_case();

fn typify_map(db: &dyn crate::Db, map: &BTreeMap<String, Type>) -> Option<Type> {
if map.is_empty() {
Expand Down

0 comments on commit c738cb6

Please sign in to comment.