@@ -103,12 +103,8 @@ func (o *Opts) PreRunE(_ []string) error {
103103		return  fmt .Errorf ("output file must be either a JSON or YAML file, got %s" , o .outputPath )
104104	}
105105
106- 	if  o .format  !=  openapi .JSON  &&  o .format  !=  openapi .YAML  {
107- 		return  fmt .Errorf ("output format must be either 'json' or 'yaml', got %s" , o .format )
108- 	}
109- 
110- 	if  strings .Contains (o .basePath , openapi .DotYAML ) {
111- 		o .format  =  openapi .YAML 
106+ 	if  err  :=  openapi .ValidateFormat (o .format ); err  !=  nil  {
107+ 		return  err 
112108	}
113109
114110	return  nil 
@@ -136,7 +132,7 @@ func Builder() *cobra.Command {
136132	cmd .Flags ().StringVarP (& opts .basePath , flag .Spec , flag .SpecShort , "-" , usage .Spec )
137133	cmd .Flags ().StringVar (& opts .env , flag .Environment , "" , usage .Environment )
138134	cmd .Flags ().StringVarP (& opts .outputPath , flag .Output , flag .OutputShort , "" , usage .Output )
139- 	cmd .Flags ().StringVarP (& opts .format , flag .Format , flag .FormatShort , openapi .JSON , usage .Format )
135+ 	cmd .Flags ().StringVarP (& opts .format , flag .Format , flag .FormatShort , openapi .ALL , usage .Format )
140136	cmd .Flags ().StringVar (& opts .gitSha , flag .GitSha , "" , usage .GitSha )
141137
142138	_  =  cmd .MarkFlagRequired (flag .Output )
0 commit comments