@@ -16,7 +16,6 @@ import {
1616 HttpClientResponse ,
1717} from "effect/unstable/http" ;
1818import { ChildProcess , ChildProcessSpawner } from "effect/unstable/process" ;
19- import { deduplicateGeneratedSchemas } from "../../../scripts/lib/deduplicateGeneratedSchemas.ts" ;
2019
2120const UPSTREAM_REF = "678157acaa819d5510adfe359abb5d0392cfe461" ;
2221const USER_AGENT = "effect-codex-app-server-generator" ;
@@ -414,7 +413,7 @@ function addAsyncQuestionFields(value: Schema.Json): Schema.Json {
414413 return {
415414 ...value ,
416415 properties : {
417- ...properties ,
416+ ...Object . fromEntries ( Object . entries ( properties ) . filter ( ( [ key ] ) => key !== "type" ) ) ,
418417 delivery : { anyOf : [ { type : "string" , enum : [ "async" ] } , { type : "null" } ] } ,
419418 questions : {
420419 anyOf : [
@@ -434,6 +433,7 @@ function addAsyncQuestionFields(value: Schema.Json): Schema.Json {
434433 { type : "null" } ,
435434 ] ,
436435 } ,
436+ type : itemType ,
437437 } ,
438438 } ;
439439 }
@@ -689,16 +689,6 @@ function rewriteExternalRefs(
689689const generateFiles = Effect . fn ( "generateFiles" ) ( function * ( ) {
690690 yield * ensureGeneratedDir ( ) ;
691691
692- if ( process . argv . includes ( "--deduplicate-existing" ) ) {
693- const fs = yield * FileSystem . FileSystem ;
694- const { schemaOutputPath } = yield * getGeneratedPaths ( ) ;
695- yield * fs . writeFileString (
696- schemaOutputPath ,
697- deduplicateGeneratedSchemas ( yield * fs . readFileString ( schemaOutputPath ) ) ,
698- ) ;
699- return ;
700- }
701-
702692 const [ rootJsonEntries , v1JsonEntries , v2JsonEntries ] = yield * Effect . all ( [
703693 fetchDirectoryEntries ( "schema/json" ) ,
704694 fetchDirectoryEntries ( "schema/json/v1" ) ,
@@ -771,7 +761,8 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
771761 for ( const [ name , schema ] of Object . entries ( aggregateSchemas ) . toSorted ( ( [ left ] , [ right ] ) =>
772762 left . localeCompare ( right ) ,
773763 ) ) {
774- generator . addSchema ( name , addAsyncQuestionFields ( schema ) as never ) ;
764+ aggregateSchemas [ name ] = addAsyncQuestionFields ( schema ) ;
765+ generator . addSchema ( name , aggregateSchemas [ name ] as never ) ;
775766 }
776767
777768 const generatedEntries = new Map < string , string > ( ) ;
@@ -915,7 +906,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
915906 const fs = yield * FileSystem . FileSystem ;
916907 const { generatedDir, metaOutputPath, namespacesOutputPath, schemaOutputPath } =
917908 yield * getGeneratedPaths ( ) ;
918- yield * fs . writeFileString ( schemaOutputPath , deduplicateGeneratedSchemas ( schemaOutput ) ) ;
909+ yield * fs . writeFileString ( schemaOutputPath , schemaOutput ) ;
919910 yield * fs . writeFileString ( metaOutputPath , metaOutput ) ;
920911 yield * fs . writeFileString ( namespacesOutputPath , namespacesOutput ) ;
921912
0 commit comments