MCPcopy
hub / github.com/subquery/subql / getSchemaPath

Function getSchemaPath

packages/common/src/project/load.ts:42–55  ·  view source on GitHub ↗
(manifestDir: string, fileName?: string)

Source from the content-addressed store, hash-verified

40}
41
42export function getSchemaPath(manifestDir: string, fileName?: string): string {
43 const rawProject = loadFromJsonOrYaml(getManifestPath(manifestDir, fileName));
44 if ((rawProject as any).specVersion === '0.0.1') {
45 return path.join(manifestDir, (rawProject as any).schema);
46 }
47 const project = rawProject as ProjectManifestV1_0_0;
48 if (!project.schema) {
49 throw new Error(`Can't get schema in yaml file`);
50 }
51 if (!project.schema.file) {
52 throw new Error(`schemaPath expect to be schema.file`);
53 }
54 return path.join(manifestDir, project.schema.file);
55}
56
57// Only work for manifest specVersion >= 1.0.0
58export function getProjectNetwork(rawManifest: unknown): NETWORK_FAMILY {

Callers 3

codegenFunction · 0.90
codegenAdapterFunction · 0.90

Calls 2

loadFromJsonOrYamlFunction · 0.85
getManifestPathFunction · 0.85

Tested by

no test coverage detected