kind: isExample()

in src/index.ts [764:793]


        kind: isExample(filePath) ? 'EXAMPLE' : 'SWAGGER',
      }))
  })

const validateIllegalFiles = (dir: string): asyncIt.AsyncIterableEx<err.Error> =>
  tscommonFs
    .recursiveReaddir(dir)
    .filter(f => (f.includes('resource-manager') || f.includes('data-plane')) && path.extname(f) === '.cadl')
    .map<err.Error>(f => ({
      code: 'INVALID_TYPESPEC_LOCATION',
      message: 'TypeSpec file is not allowed in resource-manager or data-plane folder.',
      level: 'Error',
      path: f,
    }))

/**
 * Validate global specification folder and prepare arguments for `validateInputFiles`.
 */
const validateFolder = (dir: string) =>
  asyncIt.iterable<err.Error>(async function*() {
    yield* validateIllegalFiles(dir)
    const allReadMeFiles = tscommonFs.recursiveReaddir(dir).filter(f => path.basename(f).toLowerCase() === 'readme.md')

    yield* validateRPFolderMustContainReadme(dir)

    yield* allReadMeFiles.flatMap(validateReadMeFile)

    const referencedFiles = await allReadMeFiles
      .flatMap(getInputFilesFromReadme)
      .fold((fileSet: Set<Specification>, spec) => {