Skip to content

Commit

Permalink
chore(fdr): add tags and PR links to releases data model (#1489)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Sep 17, 2024
1 parent e196774 commit 6c07651
Show file tree
Hide file tree
Showing 32 changed files with 175 additions and 77 deletions.
19 changes: 12 additions & 7 deletions fern/apis/fdr/definition/generators/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ imports:
commons: ./commons.yml

types:
CliReleaseRequest:
extends: commons.ReleaseRequest
BaseCliRelease:
properties:
irVersion:
type: integer
docs: The major version of the IR that this CLI exposes.
tags:
type: optional<list<string>>
docs: Tags to categorize the CLI release.

CliReleaseRequest:
extends:
- commons.ReleaseRequest
- BaseCliRelease

CliRelease:
extends: commons.Release
properties:
irVersion:
type: integer
docs: The major version of the IR that this CLI exposes.
extends:
- commons.Release
- BaseCliRelease

ListCliReleasesResponse:
properties:
Expand Down
8 changes: 7 additions & 1 deletion fern/apis/fdr/definition/generators/commons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ types:
properties:
type: ChangelogEntryType
summary: string
upgradeNotes: optional<string>
links:
type: optional<list<string>>
docs: |
Any URLs that are relevant to the change, such as a PR or issue. This is optional for backcompat.
You do not always need to specify the URL as the CLI can fill it in with the current PR, but given you can choose to not
release within the same PR as the change is introduced, this should be specified for divorcing the two.
upgradeNotes: optional<string>
# Keep a Changelog
added: optional<list<string>>
changed: optional<list<string>>
Expand Down
26 changes: 12 additions & 14 deletions fern/apis/fdr/definition/generators/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ imports:
root: ./__package__.yml

types:
GeneratorReleaseRequest:
extends: commons.ReleaseRequest
BaseGeneratorRelease:
properties:
generatorId: root.GeneratorId
irVersion:
Expand All @@ -20,20 +19,19 @@ types:
customConfigSchema:
type: optional<string>
docs: The JSON schema (stringified) for the custom config that this generator version supports.
tags:
type: optional<list<string>>
docs: Tags to categorize the Generator release.

GeneratorReleaseRequest:
extends:
- commons.ReleaseRequest
- BaseGeneratorRelease

GeneratorRelease:
extends: commons.Release
properties:
generatorId: root.GeneratorId
irVersion:
type: integer
docs: The major version of the IR that this generator version consumes.
migration:
type: optional<string>
docs: The TypeScript file for the migration to run when upgrading to this version.
customConfigSchema:
type: optional<string>
docs: The JSON schema (stringified) for the custom config that this generator version supports.
extends:
- commons.Release
- BaseGeneratorRelease

ListGeneratorReleasesResponse:
properties:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "CliRelease" ADD COLUMN "tags" TEXT[] DEFAULT ARRAY[]::TEXT[];

-- AlterTable
ALTER TABLE "GeneratorRelease" ADD COLUMN "tags" TEXT[] DEFAULT ARRAY[]::TEXT[];
2 changes: 2 additions & 0 deletions servers/fdr/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ model GeneratorRelease {
customConfigSchema String?
releaseType ReleaseType
tags String[] @default([])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand All @@ -222,6 +223,7 @@ model CliRelease {
changelogEntry Bytes?
releaseType ReleaseType
tags String[] @default([])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand Down
25 changes: 25 additions & 0 deletions servers/fdr/src/__test__/local/db/cliVersionsDao.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ it("cli verion not semver", async () => {
}).rejects.toThrow(new InvalidVersionError({ providedVersion: "abc.1.2" }));
});

it("cli release with tags and URLs", async () => {
const release: CliReleaseRequest = {
version: "0.1.2-rc13",
irVersion: 0,
tags: ["OpenAPI", "Fern Definition"],
changelogEntry: [
{
type: "feat",
summary: "added a new feature",
added: ["added a new feature"],
links: ["https://123.com"],
},
],
};

await fdrApplication.dao.cliVersions().upsertCliRelease({
cliRelease: release,
});

const dbRelease = await fdrApplication.dao.cliVersions().getCliRelease({ cliVersion: "0.1.2-rc13" });
expect(dbRelease).not.toBeUndefined();
expect(dbRelease?.tags).toEqual(release.tags);
expect(dbRelease?.changelogEntry?.[0]?.links).toEqual(release.changelogEntry?.[0]?.links);
});

it("cli version get latest respects semver, not time", async () => {
// create some versions and sleep between them to ensure the timestamps are different
await fdrApplication.dao.cliVersions().upsertCliRelease({
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6c07651

Please sign in to comment.