Skip to content

Commit

Permalink
fix: wrong date created
Browse files Browse the repository at this point in the history
  • Loading branch information
acunniffe committed Mar 20, 2022
1 parent ffe44d1 commit fbc98aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/workflows/file-resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function latestDateOfSet(dates: string[]): string | undefined {
}

export function formatResourceVersion(date: Date = new Date()): string {
return `${date.getFullYear()}-${padWithZero(date.getMonth())}-${padWithZero(
date.getUTCDay(),
)}`;
return `${date.getFullYear()}-${padWithZero(
date.getMonth() + 1,
)}-${padWithZero(date.getDate())}`;
}

function padWithZero(value: number): string {
Expand Down
5 changes: 4 additions & 1 deletion src/workflows/templates/new-resource-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,30 @@ export function buildNewResourceSpec(
titleResourceName,
name,
pluralName,
"wip",
);
if (!spec.components) spec.components = {};
if (!spec.components.schemas) spec.components.schemas = {};
spec.components.schemas[`${titleResourceName}Attributes`] = {
type: "object",
properties: {},
example: {},
};
// @ts-ignore
// Ignoring since `x-rest-common` is not correct according to the types.
spec.components["x-rest-common"] = refs.restCommon;
spec["x-snyk-api-stability"] = "wip";
return spec;
}

function baseOpenApiSpec(
titleResourceName: string,
name: string,
pluralName: string,
stability: string,
): OpenAPIV3.Document {
return {
openapi: "3.0.3",
"x-snyk-api-stability": stability,
info: {
title: `${titleResourceName} Resource`,
version: "3.0.0",
Expand Down

0 comments on commit fbc98aa

Please sign in to comment.