// DiscoverOpenApiSpecs finds JSON and YAML OpenAPI specification files
// within the given directory. It returns fully qualified paths
// to the files discovered.
DiscoverOpenApiSpecs finds JSON and YAML OpenAPI specification files
within the given directory. It returns fully qualified paths
to the files discovered.
// DiscoverOpenApiSpecs finds JSON and YAML OpenAPI specification files // within the given directory . It returns fully qualified paths // to the files discovered .
func DiscoverOpenApiSpecs(configDir string) []string {
	var openApiSpecs []string
	for _, yamlFile := range append(fileutil.FindFilesWithExtension(configDir, ".yaml"), fileutil.FindFilesWithExtension(configDir, ".yml")...) {
		fullyQualifiedPath := filepath.Join(configDir, yamlFile)
		jsonContent, err := loadYamlAsJson(fullyQualifiedPath)
		if err != nil {
			logrus.Fatal(err)
		}
		if isOpenApiSpec(jsonContent) {
			openApiSpecs = append(openApiSpecs, fullyQualifiedPath)
		}
	}
	for _, jsonFile := range fileutil.FindFilesWithExtension(configDir, ".json") {
		fullyQualifiedPath := filepath.Join(configDir, jsonFile)
		jsonContent, err := ioutil.ReadFile(fullyQualifiedPath)
		if err != nil {
			logrus.Fatal(err)
		}
		if isOpenApiSpec(jsonContent) {
			openApiSpecs = append(openApiSpecs, fullyQualifiedPath)
		}
	}
	return openApiSpecs
}
func DiscoverOpenApiSpecs ( configDir string ) [ ] string { var openApiSpecs [ ] string for _ , yamlFile := range append ( fileutil . FindFilesWithExtension ( configDir , " " ) , fileutil . FindFilesWithExtension ( configDir , " " ) ... ) { fullyQualifiedPath := filepath . Join ( configDir , yamlFile ) jsonContent , err := loadYamlAsJson ( fullyQualifiedPath ) if err != nil { logrus . Fatal ( err ) } if isOpenApiSpec ( jsonContent ) { openApiSpecs = append ( openApiSpecs , fullyQualifiedPath ) } } for _ , jsonFile := range fileutil . FindFilesWithExtension ( configDir , " " ) { fullyQualifiedPath := filepath . Join ( configDir , jsonFile ) jsonContent , err := ioutil . ReadFile ( fullyQualifiedPath ) if err != nil { logrus . Fatal ( err ) } if isOpenApiSpec ( jsonContent ) { openApiSpecs = append ( openApiSpecs , fullyQualifiedPath ) } } return openApiSpecs }
DiscoverOpenApiSpecs finds JSON and YAML OpenAPI specification files
within the given directory.
DiscoverOpenApiSpecs finds JSON and YAML OpenAPI specification files within the given directory .