1+ using System . Collections . Immutable ;
12using System . Text ;
23using System . Text . Json ;
34using ChilliCream . Nitro . CommandLine . Cloud . Client ;
4- using ChilliCream . Nitro . CommandLine . Cloud . Helpers ;
55using ChilliCream . Nitro . CommandLine . Cloud . Option ;
66using ChilliCream . Nitro . CommandLine . Cloud . Option . Binders ;
77using HotChocolate . Adapters . OpenApi ;
@@ -66,15 +66,9 @@ await console
6666
6767 async Task UploadOpenApiCollection ( StatusContext ? ctx )
6868 {
69- Matcher matcher = new ( ) ;
70- matcher . AddIncludePatterns ( patterns ) ;
69+ var files = GlobMatcher . Match ( patterns ) . ToArray ( ) ;
7170
72- // TODO: Does this work with absolute paths?
73- var globResult = matcher . Execute (
74- new DirectoryInfoWrapper (
75- new DirectoryInfo ( Directory . GetCurrentDirectory ( ) ) ) ) ;
76-
77- if ( ! globResult . HasMatches )
71+ if ( files . Length < 1 )
7872 {
7973 // TODO: Improve this error
8074 console . ErrorLine ( "Did not find any matches..." ) ;
@@ -84,13 +78,18 @@ async Task UploadOpenApiCollection(StatusContext? ctx)
8478 var archiveStream = new MemoryStream ( ) ;
8579 var collectionArchive = OpenApiCollectionArchive . Create ( archiveStream , leaveOpen : true ) ;
8680
81+ await collectionArchive . SetArchiveMetadataAsync (
82+ new ArchiveMetadata ( ) ,
83+ cancellationToken ) ;
84+
8785 var parser = new OpenApiDocumentParser ( ) ;
8886
89- foreach ( var file in globResult . Files )
87+ foreach ( var file in files )
9088 {
91- var document = Utf8GraphQLParser . Parse ( "" ) ;
89+ var fileContent = await File . ReadAllBytesAsync ( file , cancellationToken ) ;
90+ var document = Utf8GraphQLParser . Parse ( fileContent ) ;
9291 // TODO: The id doesn't mean anything, we should probably get rid of it...
93- var openApiDocumentDefinition = new OpenApiDocumentDefinition ( file . Path , document ) ;
92+ var openApiDocumentDefinition = new OpenApiDocumentDefinition ( file , document ) ;
9493
9594 var parseResult = parser . Parse ( openApiDocumentDefinition ) ;
9695
0 commit comments