Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mearman committed Jun 29, 2024
1 parent e5836ce commit b9fc28a
Show file tree
Hide file tree
Showing 256 changed files with 609 additions and 584 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/asn1-npm-0.2.6-bdd07356c4-cf629291fe.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/jsbn-npm-0.1.1-0eb7132404-5450133242.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/keyv-npm-4.5.4-4c8e2cf7f7-167eb6ef64.zip
Binary file not shown.
Binary file removed .yarn/cache/levn-npm-0.4.1-d183b2d7bb-2e4720ff79.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ms-npm-2.0.0-9e1101a471-0e6a22b8b7.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/psl-npm-1.9.0-a546edad1a-d07879d4bf.zip
Binary file not shown.
Binary file removed .yarn/cache/qs-npm-6.5.3-90b2635484-485c990fba.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/uuid-npm-3.4.0-4fd8ef88ad-4f2b86432b.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { GENERATION_DIR } from "~/util/generateDereferencedSpec";
async function main() {
const doc = getDoc();
console.log(inspect(doc, {
depth: null,
depth: 3,
colors: true,
}));
separator();
Expand Down
20 changes: 19 additions & 1 deletion src/spec/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,28 @@ export class ComponentGenerator {
);
}

const existing = ComponentGenerator.getInstance()[comp]?.[referenceKey];
if (existing) {
if (existing !== value) {
throw new Error(
`Tried to create reference ${JSON.stringify(referenceKey)} with a different value than the existing one: ${JSON.stringify(
obj
)} in ${JSON.stringify(comp)}.`
);
}
return {
$ref: `#/components/${comp}/${referenceKey}`,
};
}

const newObj = {
[referenceKey]: value,
};

// add to instance
ComponentGenerator.getInstance()[comp] = {
...ComponentGenerator.getInstance()[comp],
[referenceKey]: value,
...newObj,
};
return {
$ref: `#/components/${comp}/${referenceKey}`,
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/authorsGet200.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { authorsResponseSchema } from "~/spec/components/schemas/authors/authors
export const authorsGet200: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ authorsResponseSchema }),
schema: refSchema({ authors: authorsResponseSchema }),
},
},
description: "Authors List Response",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { conceptsResponseSchema } from "~/spec/components/schemas/concepts/conce
export const conceptsGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ conceptsResponseSchema }),
schema: refSchema({ concepts: conceptsResponseSchema }),
},
},
description: "Concepts List",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/funderGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { funderSchema } from "~/spec/components/schemas/funders/funderSchema";
export const funderGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ funderSchema }),
schema: refSchema({ funder: funderSchema }),
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/getPerson200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { personResponseSchema } from "~/spec/components/schemas/authors/personRe
export const getPerson200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ personResponseSchema }),
schema: refSchema({ person: personResponseSchema }),
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/institutionGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { institutionSchema } from "~/spec/components/schemas/institutions/instit
export const institutionGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ institutionSchema })
schema: refSchema({ institution: institutionSchema }),
},
},
description: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { institutionsResponseSchema } from "~/spec/components/schemas/institutio
export const institutionsGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ institutionsResponseSchema }),
schema: refSchema({ institutions: institutionsResponseSchema }),
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/publisherGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { publisherSchema } from "~/spec/components/schemas/publishers/publisherS
export const publisherGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ publisherSchema }),
schema: refSchema({ publisher: publisherSchema }),
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/publishersGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { publishersResponseSchema } from "~/spec/components/schemas/publishers/p
export const publishersGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ publishersResponseSchema }),
schema: refSchema({ publishers: publishersResponseSchema }),
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/responses/sourceGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sourceSchema } from "~/spec/components/schemas/sources/sourceSchema";
export const sourceGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ sourceSchema }),
schema: refSchema({ source: sourceSchema }),
},
},
description: "",
Expand Down
6 changes: 3 additions & 3 deletions src/spec/components/responses/sourcesGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { sourcesArray } from "~/spec/components/schemas/sources/sourcesArray";
export const sourcesGet200Response: ResponseObject = {
content: {
"application/json": {
schema: refSchema({ sourcesArray })
}
schema: refSchema({ sources: sourcesArray }),
},
},
description: ""
description: "",
};
2 changes: 1 addition & 1 deletion src/spec/components/responses/workNgramsGet200Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const workNgramsGet200Response: ResponseObject = {
examples: {
ngram: refExample({ workNgramsGet200ResponseExample }),
},
schema: refSchema({ workNgramsSchema }),
schema: refSchema({ ngrams: workNgramsSchema }),
},
},
description: "",
Expand Down
4 changes: 2 additions & 2 deletions src/spec/components/responses/works/work.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { refSchema } from "~/spec/components";
import { workSchema } from "~/spec/components/schemas/works/work";

export const works = {
export const work = {
content: {
"application/json": {
schema: refSchema({ workSchema }),
schema: refSchema({ work: workSchema }),
},
},
description: "",
Expand Down
19 changes: 2 additions & 17 deletions src/spec/components/responses/works/works.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
import { refSchema } from "~/spec/components";
import { worksResponseSchema } from "../../schemas/works/worksResponseSchema";

import { group_by_result } from "~/spec/components/schemas/system/group_by_result";
import { meta } from "~/spec/components/schemas/system/meta";
import { workSchema } from "~/spec/components/schemas/works/work";

let worksResponseSchema: SchemaObject = {
properties: {
meta: refSchema({ meta }),
results: {
type: "array",
items: refSchema({ workSchema }),
},
group_by: refSchema({ group_by_result }),
},
required: ["meta", "results"],
type: "object",
}
;
export const works = {
content: {
"application/json": {
schema: refSchema({ worksResponseSchema }),
schema: refSchema({ worksResponse: worksResponseSchema })
},
},
description: "",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/schemas/authors/author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const author = {
last_known_institution: refSchema({ dehydratedInstitution }),
last_known_institutions: refSchema({ dehydratedInstitutionArray }),
orcid: {
type: ["string", "null"]
type: "string"
},
summary_stats: refSchema({ summary_stats }),
updated_date: {
Expand Down
6 changes: 3 additions & 3 deletions src/spec/components/schemas/concepts/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const conceptSchema = {
type: "string",
},
description: {
type: ["string", "null"]
type: "string"
},
display_name: {
type: "string",
Expand Down Expand Up @@ -53,10 +53,10 @@ export const conceptSchema = {
type: "object",
},
image_thumbnail_url: {
type: ["string", "null"]
type: "string"
},
image_url: {
type: ["string", "null"]
type: "string"
},
international: refSchema({ international_display_name_and_description }),
level: {
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/schemas/concepts/conceptsArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { refSchema } from "~/spec/components";
import { conceptSchema } from "~/spec/components/schemas/concepts/concept";

export const conceptsArray = {
items: refSchema({ conceptSchema }),
items: refSchema({ concept: conceptSchema }),
type: "array",
} satisfies SchemaObject;
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { group_by_result } from "~/spec/components/schemas/system/group_by_resul
import { meta } from "~/spec/components/schemas/system/meta";

export const conceptsResponseSchema: SchemaObject = {
type: "object",
properties: {
group_by: refSchema({ group_by_result }),
meta: refSchema({ meta }),
results: refSchema({ conceptsArray }),
results: refSchema({ conceptArray: conceptsArray }),
},
};
2 changes: 1 addition & 1 deletion src/spec/components/schemas/concepts/dehydratedConcept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const dehydratedConcept = {
type: "number",
},
wikidata: {
type: ["string", "null"]
type: "string"
},
},
required: [
Expand Down
10 changes: 5 additions & 5 deletions src/spec/components/schemas/funders/funderSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const funderSchema = {
type: "integer",
},
country_code: {
type: ["string", "null"],
type: "string",
},
counts_by_year: refSchema({ countsByYear }),
created_date: {
type: "string",
},
description: {
type: ["string", "null"],
type: "string",
},
display_name: {
type: "string",
Expand All @@ -33,17 +33,17 @@ export const funderSchema = {
type: "integer",
},
homepage_url: {
type: ["string", "null"]
type: "string"
},
id: {
type: "string",
},
ids: refSchema({ ids }),
image_thumbnail_url: {
type: ["string", "null"]
type: "string"
},
image_url: {
type: ["string", "null"]
type: "string"
},
relevance_score: {
type: "number",
Expand Down
6 changes: 3 additions & 3 deletions src/spec/components/schemas/institutions/geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const geo = {
type: "string",
},
country_code: {
type: ["string", "null"]
type: "string"
},
geonames_city_id: {
type: ["string", "null"],
type: "string",
},
latitude: {
type: "number",
Expand All @@ -19,7 +19,7 @@ export const geo = {
type: "number",
},
region: {
type: ["string", "null"],
type: "string",
},
},
required: [
Expand Down
6 changes: 3 additions & 3 deletions src/spec/components/schemas/institutions/institutionSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const institutionSchema: SchemaObject = {
type: "integer",
},
country_code: {
type: ["string", "null"]
type: "string"
},
counts_by_year: refSchema({ countsByYear }),
created_date: {
Expand Down Expand Up @@ -50,10 +50,10 @@ export const institutionSchema: SchemaObject = {
},
ids: refSchema({ ids }),
image_thumbnail_url: {
type: ["string", "null"]
type: "string"
},
image_url: {
type: ["string", "null"]
type: "string"
},
international: refSchema({ international_display_name }),
lineage: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const international_description = {
properties: {
description: refSchema({ internationalisation })
},
type: ["object", "null"],
type: "object",
} satisfies SchemaObject;

export const international_display_name_and_description = {
Expand Down
8 changes: 4 additions & 4 deletions src/spec/components/schemas/publishers/publisherSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ export const publisherSchema = {
type: "integer",
},
homepage_url: {
type: ["string", "null"]
type: "string"
},
id: {
type: "string",
},
ids: refSchema({ ids }),
image_thumbnail_url: {
type: ["string", "null"]
type: "string"
},
image_url: {
type: ["string", "null"]
type: "string"
},
lineage: {
items: {
Expand All @@ -52,7 +52,7 @@ export const publisherSchema = {
type: "array",
},
parent_publisher: {
type: ["object", "null"],
type: "object",
properties: {
display_name: {
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion src/spec/components/schemas/sources/apc_prices.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const apc_prices: SchemaObject = {
additionalProperties: false,
type: ["array", "null"],
type: "array",
items: {
additionalProperties: false,
properties: {
Expand Down
Loading

0 comments on commit b9fc28a

Please sign in to comment.