Skip to content

Commit cba26f9

Browse files
Allow openapi generator to remove unknown files from output dir (#2281)
Fix #2273 <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Add `REMOVE_DIR_BEHAVIOR` to `OpenApiLanguageFeatures` to allow removal of unknown files from output directory. > > - **Behavior**: > - Add `REMOVE_DIR_BEHAVIOR` constant to `OpenApiLanguageFeatures` in `openapi/src/lib.rs`, allowing removal of unknown files from output directory. > - **Code Structure**: > - Comment out `dir_writer` module import in `language_client_codegen/src/lib.rs`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 9fe9295. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 81a5857 commit cba26f9

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

  • engine
    • generators/languages/openapi/src
    • language_client_codegen/src

‎engine/generators/languages/openapi/src/lib.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::hash::Hash;
22

3-
use dir_writer::{FileCollector, GeneratorArgs, IntermediateRepr, LanguageFeatures};
3+
use dir_writer::{
4+
FileCollector, GeneratorArgs, IntermediateRepr, LanguageFeatures, RemoveDirBehavior,
5+
};
46
use indexmap::IndexMap;
57
use serde::Serialize;
68

@@ -19,6 +21,10 @@ impl LanguageFeatures for OpenApiLanguageFeatures {
1921
"openapi"
2022
}
2123

24+
/// OpenAPI codegen creates a lot of files that BAML can't know about in
25+
/// advance, so we allow removing them.
26+
const REMOVE_DIR_BEHAVIOR: RemoveDirBehavior = RemoveDirBehavior::Unsafe;
27+
2228
const CONTENT_PREFIX: &'static str = r#"
2329
###############################################################################
2430
#

‎engine/language_client_codegen/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use regex::Regex;
1414
use sugar_path::SugarPath;
1515
use version_check::{check_version, GeneratorType, VersionCheckMode};
1616

17-
mod dir_writer;
17+
// mod dir_writer;
1818
// mod go;
1919
// pub mod openapi;
2020
// mod python;

0 commit comments

Comments
 (0)