Skip to content

Commit

Permalink
feat: add evaluation routes(#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
viveknair committed May 31, 2023
1 parent ff16081 commit 4267817
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 56 deletions.
4 changes: 2 additions & 2 deletions openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"node": {
"generatorName": "typescript-axios",
"output": "../gentrace-node/package",
"inputSpec": "./dist/ingestion.yaml",
"inputSpec": "./dist/core.yaml",
"templateDir": "./templates/node",
"additionalProperties": {
"npmName": "@gentrace/node",
Expand All @@ -21,7 +21,7 @@
"generatorName": "python",
"templateDir": "./templates/python",
"output": "../gentrace-python/package",
"inputSpec": "./dist/ingestion.yaml",
"inputSpec": "./dist/core.yaml",
"additionalProperties": {
"packageName": "gentrace"
}
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
]
},
"scripts": {
"build": "run-s sconfig generate ",
"build": "run-s sconfig generate",
"build-py": "run-s sconfig generate:python",
"build-node": "run-s sconfig generate:node-ts",
"build-browser": "run-s sconfig generate:browser",
"clean": "rimraf dist",
"bump-patch": "./scripts/bump-patch",
"sconfig": "run-s sconfig:spec-version sconfig:create-custom-specs",
Expand Down
14 changes: 7 additions & 7 deletions scripts/create-custom-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ type OpenAPISpec = {
};
};

const ingestionSpec = yaml.load(
const coreSpec = yaml.load(
fs.readFileSync(RESOLVED_SPEC_LOCATION, "utf8")
) as OpenAPISpec;

const ingestionTag = "Ingestion";
const ingestionPaths = Object.fromEntries(
Object.entries(ingestionSpec.paths).filter(([, data]) =>
Object.values(data).some((op) => op.tags && op.tags.includes(ingestionTag))
const coreTag = "Core";
const corePaths = Object.fromEntries(
Object.entries(coreSpec.paths).filter(([, data]) =>
Object.values(data).some((op) => op.tags && op.tags.includes(coreTag))
)
);

ingestionSpec.paths = ingestionPaths;
coreSpec.paths = corePaths;

fs.mkdirpSync("dist");
fs.writeFileSync("dist/ingestion.yaml", yaml.dump(ingestionSpec));
fs.writeFileSync("dist/core.yaml", yaml.dump(coreSpec));

const feedbackSpec = yaml.load(
fs.readFileSync(RESOLVED_SPEC_LOCATION, "utf8")
Expand Down

0 comments on commit 4267817

Please sign in to comment.