Skip to content

Commit

Permalink
denormalize spec on capture upload (#2603)
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim authored Dec 13, 2023
1 parent 31f721e commit a541156
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "openapi-workspaces",
"license": "MIT",
"private": true,
"version": "0.53.10",
"version": "0.53.11",
"workspaces": [
"projects/json-pointer-helpers",
"projects/openapi-io",
Expand Down
2 changes: 1 addition & 1 deletion projects/fastify-capture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/fastify-capture",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/json-pointer-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/json-pointer-helpers",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-io",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-utilities",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/optic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/optic",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
6 changes: 4 additions & 2 deletions projects/optic/src/commands/capture/capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';
import fs from 'node:fs/promises';
import fsNonPromise from 'node:fs';

import { isJson, isYaml, writeYaml } from '@useoptic/openapi-io';
import { denormalize, isJson, isYaml, writeYaml } from '@useoptic/openapi-io';
import { CoverageNode, OperationCoverage } from '@useoptic/openapi-utilities';
import { errorHandler } from '../../error-handler';

Expand Down Expand Up @@ -302,6 +302,8 @@ const getCaptureAction =
process.exitCode = 1;
return;
}
// We need to load the spec as is with denormalize=true so that the endpoint shas match
spec = denormalize(spec);

const opticUrlDetails = await getOpticUrlDetails(config, {
filePath: path.relative(config.root, path.resolve(filePath)),
Expand Down Expand Up @@ -472,7 +474,7 @@ export async function processCaptures(
}

// update existing endpoints
const coverage = new ApiCoverageCounter(spec.jsonLike);
const coverage = new ApiCoverageCounter(denormalize(spec).jsonLike);
let hasAnyDiffs = false;
let diffCount = 0;
let endpointsAdded = 0;
Expand Down
2 changes: 1 addition & 1 deletion projects/rulesets-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/rulesets-base",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/standard-rulesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/standard-rulesets",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.53.10",
"version": "0.53.11",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down

0 comments on commit a541156

Please sign in to comment.