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
7
use comfy_table:: Attribute :: Bold ;
10
8
use comfy_table:: Cell ;
11
9
use comfy_table:: CellAlignment :: Center ;
12
- use serde_json:: { json, Value } ;
13
- use termimad:: { crossterm:: style:: Attribute :: Underlined , MadSkin } ;
14
-
15
10
use rover_client:: operations:: contract:: describe:: ContractDescribeResponse ;
16
11
use rover_client:: operations:: contract:: publish:: ContractPublishResponse ;
17
12
use rover_client:: operations:: graph:: publish:: GraphPublishResponse ;
@@ -25,11 +20,13 @@ use rover_client::shared::{
25
20
} ;
26
21
use rover_client:: RoverClientError ;
27
22
use rover_std:: Style ;
23
+ use serde_json:: { json, Value } ;
24
+ use termimad:: crossterm:: style:: Attribute :: Underlined ;
25
+ use termimad:: MadSkin ;
28
26
29
27
use crate :: command:: supergraph:: compose:: CompositionOutput ;
30
28
use crate :: command:: template:: queries:: list_templates_for_language:: ListTemplatesForLanguageTemplates ;
31
- use crate :: options:: JsonVersion ;
32
- use crate :: options:: ProjectLanguage ;
29
+ use crate :: options:: { JsonVersion , ProjectLanguage } ;
33
30
use crate :: utils:: table;
34
31
use crate :: RoverError ;
35
32
@@ -56,6 +53,7 @@ pub enum RoverOutput {
56
53
DocsList ( BTreeMap < & ' static str , & ' static str > ) ,
57
54
FetchResponse ( FetchResponse ) ,
58
55
SupergraphSchema ( String ) ,
56
+ JsonSchema ( String ) ,
59
57
CompositionResult ( CompositionOutput ) ,
60
58
SubgraphList ( SubgraphListResponse ) ,
61
59
CheckWorkflowResponse ( CheckWorkflowResponse ) ,
@@ -284,6 +282,7 @@ impl RoverOutput {
284
282
}
285
283
}
286
284
RoverOutput :: SupergraphSchema ( csdl) => Some ( ( csdl) . to_string ( ) ) ,
285
+ RoverOutput :: JsonSchema ( schema) => Some ( schema. clone ( ) ) ,
287
286
RoverOutput :: CompositionResult ( composition_output) => {
288
287
let warn_prefix = Style :: HintPrefix . paint ( "HINT:" ) ;
289
288
@@ -498,6 +497,7 @@ impl RoverOutput {
498
497
}
499
498
RoverOutput :: FetchResponse ( fetch_response) => json ! ( fetch_response) ,
500
499
RoverOutput :: SupergraphSchema ( csdl) => json ! ( { "core_schema" : csdl } ) ,
500
+ RoverOutput :: JsonSchema ( schema) => Value :: String ( schema. clone ( ) ) ,
501
501
RoverOutput :: CompositionResult ( composition_output) => {
502
502
if let Some ( federation_version) = & composition_output. federation_version {
503
503
json ! ( {
@@ -681,28 +681,20 @@ mod tests {
681
681
use apollo_federation_types:: rover:: { BuildError , BuildErrors } ;
682
682
use assert_json_diff:: assert_json_eq;
683
683
use chrono:: { DateTime , Local , Utc } ;
684
-
685
684
use console:: strip_ansi_codes;
686
- use rover_client:: {
687
- operations:: {
688
- graph:: publish:: { ChangeSummary , FieldChanges , TypeChanges } ,
689
- persisted_queries:: publish:: PersistedQueriesOperationCounts ,
690
- subgraph:: {
691
- delete:: SubgraphDeleteResponse ,
692
- list:: { SubgraphInfo , SubgraphUpdatedAt } ,
693
- } ,
694
- } ,
695
- shared:: {
696
- ChangeSeverity , CheckTaskStatus , CheckWorkflowResponse , CustomCheckResponse ,
697
- Diagnostic , LintCheckResponse , OperationCheckResponse , ProposalsCheckResponse ,
698
- ProposalsCheckSeverityLevel , ProposalsCoverage , RelatedProposal , SchemaChange , Sdl ,
699
- SdlType , Violation ,
700
- } ,
685
+ use rover_client:: operations:: graph:: publish:: { ChangeSummary , FieldChanges , TypeChanges } ;
686
+ use rover_client:: operations:: persisted_queries:: publish:: PersistedQueriesOperationCounts ;
687
+ use rover_client:: operations:: subgraph:: delete:: SubgraphDeleteResponse ;
688
+ use rover_client:: operations:: subgraph:: list:: { SubgraphInfo , SubgraphUpdatedAt } ;
689
+ use rover_client:: shared:: {
690
+ ChangeSeverity , CheckTaskStatus , CheckWorkflowResponse , CustomCheckResponse , Diagnostic ,
691
+ LintCheckResponse , OperationCheckResponse , ProposalsCheckResponse ,
692
+ ProposalsCheckSeverityLevel , ProposalsCoverage , RelatedProposal , SchemaChange , Sdl ,
693
+ SdlType , Violation ,
701
694
} ;
702
695
703
- use crate :: options:: JsonOutput ;
704
-
705
696
use super :: * ;
697
+ use crate :: options:: JsonOutput ;
706
698
707
699
#[ test]
708
700
fn docs_list_json ( ) {
0 commit comments