1
- use std:: {
2
- collections:: BTreeMap ,
3
- fmt:: Write ,
4
- io:: { self , IsTerminal } ,
5
- } ;
1
+ use std:: collections:: BTreeMap ;
2
+ use std:: fmt:: Write ;
3
+ use std:: io:: { self , IsTerminal } ;
6
4
7
5
use calm_io:: { stderr, stderrln} ;
8
6
use camino:: Utf8PathBuf ;
9
- use serde_json:: { json, Value } ;
10
- use termimad:: { crossterm:: style:: Attribute :: Underlined , MadSkin } ;
11
-
12
7
use rover_client:: operations:: contract:: describe:: ContractDescribeResponse ;
13
8
use rover_client:: operations:: contract:: publish:: ContractPublishResponse ;
14
9
use rover_client:: operations:: graph:: publish:: GraphPublishResponse ;
@@ -22,11 +17,13 @@ use rover_client::shared::{
22
17
} ;
23
18
use rover_client:: RoverClientError ;
24
19
use rover_std:: Style ;
20
+ use serde_json:: { json, Value } ;
21
+ use termimad:: crossterm:: style:: Attribute :: Underlined ;
22
+ use termimad:: MadSkin ;
25
23
26
24
use crate :: command:: supergraph:: compose:: CompositionOutput ;
27
25
use crate :: command:: template:: queries:: list_templates_for_language:: ListTemplatesForLanguageTemplates ;
28
- use crate :: options:: JsonVersion ;
29
- use crate :: options:: ProjectLanguage ;
26
+ use crate :: options:: { JsonVersion , ProjectLanguage } ;
30
27
use crate :: utils:: table:: { self , row} ;
31
28
use crate :: RoverError ;
32
29
@@ -53,6 +50,7 @@ pub enum RoverOutput {
53
50
DocsList ( BTreeMap < & ' static str , & ' static str > ) ,
54
51
FetchResponse ( FetchResponse ) ,
55
52
SupergraphSchema ( String ) ,
53
+ JsonSchema ( String ) ,
56
54
CompositionResult ( CompositionOutput ) ,
57
55
SubgraphList ( SubgraphListResponse ) ,
58
56
CheckWorkflowResponse ( CheckWorkflowResponse ) ,
@@ -278,6 +276,7 @@ impl RoverOutput {
278
276
}
279
277
}
280
278
RoverOutput :: SupergraphSchema ( csdl) => Some ( ( csdl) . to_string ( ) ) ,
279
+ RoverOutput :: JsonSchema ( schema) => Some ( schema. clone ( ) ) ,
281
280
RoverOutput :: CompositionResult ( composition_output) => {
282
281
let warn_prefix = Style :: HintPrefix . paint ( "HINT:" ) ;
283
282
@@ -486,6 +485,7 @@ impl RoverOutput {
486
485
}
487
486
RoverOutput :: FetchResponse ( fetch_response) => json ! ( fetch_response) ,
488
487
RoverOutput :: SupergraphSchema ( csdl) => json ! ( { "core_schema" : csdl } ) ,
488
+ RoverOutput :: JsonSchema ( schema) => Value :: String ( schema. clone ( ) ) ,
489
489
RoverOutput :: CompositionResult ( composition_output) => {
490
490
if let Some ( federation_version) = & composition_output. federation_version {
491
491
json ! ( {
@@ -669,28 +669,20 @@ mod tests {
669
669
use apollo_federation_types:: rover:: { BuildError , BuildErrors } ;
670
670
use assert_json_diff:: assert_json_eq;
671
671
use chrono:: { DateTime , Local , Utc } ;
672
-
673
672
use console:: strip_ansi_codes;
674
- use rover_client:: {
675
- operations:: {
676
- graph:: publish:: { ChangeSummary , FieldChanges , TypeChanges } ,
677
- persisted_queries:: publish:: PersistedQueriesOperationCounts ,
678
- subgraph:: {
679
- delete:: SubgraphDeleteResponse ,
680
- list:: { SubgraphInfo , SubgraphUpdatedAt } ,
681
- } ,
682
- } ,
683
- shared:: {
684
- ChangeSeverity , CheckTaskStatus , CheckWorkflowResponse , CustomCheckResponse ,
685
- Diagnostic , LintCheckResponse , OperationCheckResponse , ProposalsCheckResponse ,
686
- ProposalsCheckSeverityLevel , ProposalsCoverage , RelatedProposal , SchemaChange , Sdl ,
687
- SdlType , Violation ,
688
- } ,
673
+ use rover_client:: operations:: graph:: publish:: { ChangeSummary , FieldChanges , TypeChanges } ;
674
+ use rover_client:: operations:: persisted_queries:: publish:: PersistedQueriesOperationCounts ;
675
+ use rover_client:: operations:: subgraph:: delete:: SubgraphDeleteResponse ;
676
+ use rover_client:: operations:: subgraph:: list:: { SubgraphInfo , SubgraphUpdatedAt } ;
677
+ use rover_client:: shared:: {
678
+ ChangeSeverity , CheckTaskStatus , CheckWorkflowResponse , CustomCheckResponse , Diagnostic ,
679
+ LintCheckResponse , OperationCheckResponse , ProposalsCheckResponse ,
680
+ ProposalsCheckSeverityLevel , ProposalsCoverage , RelatedProposal , SchemaChange , Sdl ,
681
+ SdlType , Violation ,
689
682
} ;
690
683
691
- use crate :: options:: JsonOutput ;
692
-
693
684
use super :: * ;
685
+ use crate :: options:: JsonOutput ;
694
686
695
687
#[ test]
696
688
fn docs_list_json ( ) {
0 commit comments