Skip to content

Commit

Permalink
Custom upload fixes (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim authored Jul 31, 2024
1 parent ea4d29f commit db947f4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 11 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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
6 changes: 5 additions & 1 deletion projects/optic/src/commands/diff/diff-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,11 @@ const getDiffAllAction =
);
process.exitCode = 1;
return;
} else if (options.upload && !config.isAuthenticated) {
} else if (
options.upload &&
!config.isAuthenticated &&
!customOptions.customUpload
) {
logger.error(
chalk.bold.red(
'Error: Must be logged in to upload results. Run optic login to authenticate.'
Expand Down
6 changes: 5 additions & 1 deletion projects/optic/src/commands/diff/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ const getDiffAction =
// For json output we only want to render json
logger.setLevel('silent');
}
if (options.upload && !config.isAuthenticated) {
if (
options.upload &&
!config.isAuthenticated &&
!customOptions.customUpload
) {
logger.error(
chalk.bold.red(
'Error: Must be logged in to upload results. Run optic login to authenticate.'
Expand Down
9 changes: 8 additions & 1 deletion projects/optic/src/utils/spec-loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,21 @@ export type ParseResult =
| (ParseOpenAPIResult<FlatOpenAPIV2.Document> & {
isEmptySpec: boolean;
from: 'git' | 'file' | 'url' | 'empty' | 'cloud';
fileContext: SpecFromInput;
version: '2.x.x';
context: ParseResultContext;
})
| (ParseOpenAPIResult<FlatOpenAPIV3.Document> & {
isEmptySpec: boolean;
from: 'git' | 'file' | 'url' | 'empty' | 'cloud';
fileContext: SpecFromInput;
version: '3.0.x';
context: ParseResultContext;
})
| (ParseOpenAPIResult<FlatOpenAPIV3_1.Document> & {
isEmptySpec: boolean;
from: 'git' | 'file' | 'url' | 'empty' | 'cloud';
fileContext: SpecFromInput;
version: '3.1.x';
context: ParseResultContext;
});
Expand Down Expand Up @@ -209,6 +212,7 @@ async function parseSpecAndDereference(
const sourcemap = createNullSpecSourcemap(spec);
return {
jsonLike: spec,
fileContext: input,
sourcemap,
from: 'empty',
version: '3.0.x',
Expand All @@ -225,6 +229,7 @@ async function parseSpecAndDereference(
);
return {
jsonLike,
fileContext: input,
sourcemap,
version: checkOpenAPIVersion(jsonLike),
from: 'cloud',
Expand Down Expand Up @@ -255,6 +260,7 @@ async function parseSpecAndDereference(
...parseResult,
version: checkOpenAPIVersion(parseResult.jsonLike),
from: 'git',
fileContext: input,
isEmptySpec: false,
context: {
vcs: 'git',
Expand All @@ -273,7 +279,7 @@ async function parseSpecAndDereference(
return {
...parseResult,
version: checkOpenAPIVersion(parseResult.jsonLike),

fileContext: input,
from: 'url',
isEmptySpec: false,
context: null,
Expand Down Expand Up @@ -303,6 +309,7 @@ async function parseSpecAndDereference(

return {
...parseResult,
fileContext: input,
version: checkOpenAPIVersion(parseResult.jsonLike),
from: 'file',
isEmptySpec: false,
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.55.0",
"version": "0.55.1",
"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.55.0",
"version": "0.55.1",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down

0 comments on commit db947f4

Please sign in to comment.