Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fallowrc.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["npm:@block65/shared-config/lib/fallow/fallow.jsonc"],
"extends": ["npm:@block65/shared-config/fallow.jsonc"],

"entry": ["bin/index.ts", "oxfmt.config.ts", "oxlint.config.ts"],

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ jobs:
- run: just fmt-check
- run: just test
- run: just dead-code
- run: just dupes
15 changes: 9 additions & 6 deletions __tests__/event-stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { oas32 } from "openapi3-ts";
import { describe, expect, test } from "vitest";
import { processOpenApiDocument } from "../lib/process-document.ts";

function documentWith(
function buildEventStreamDocument(
itemSchema: oas32.SchemaObject | oas32.ReferenceObject | undefined,
schemas: Record<string, oas32.SchemaObject> = {},
) {
Expand Down Expand Up @@ -43,7 +43,7 @@ function jsonData(contentSchema: oas32.SchemaObject | oas32.ReferenceObject) {
test("without an itemSchema, a plain command", async () => {
const result = await processOpenApiDocument(
"/tmp/whatever",
documentWith(undefined),
buildEventStreamDocument(undefined),
);

expect(result.commandsFile.getText()).toMatchSnapshot("commands.ts");
Expand All @@ -58,7 +58,7 @@ test("without an itemSchema, a plain command", async () => {
test("JSON data variants make the output a union", async () => {
const result = await processOpenApiDocument(
"/tmp/whatever",
documentWith(
buildEventStreamDocument(
{
oneOf: [
{
Expand Down Expand Up @@ -105,7 +105,7 @@ test("JSON data variants make the output a union", async () => {
test("data with no contentMediaType is text", async () => {
const result = await processOpenApiDocument(
"/tmp/whatever",
documentWith({
buildEventStreamDocument({
type: "object",
properties: { data: { type: "string" } },
}),
Expand Down Expand Up @@ -171,13 +171,16 @@ describe("event-stream refusals", () => {
],
])("%s", async (_, itemSchema, message) => {
await expect(
processOpenApiDocument("/tmp/whatever", documentWith(itemSchema)),
processOpenApiDocument(
"/tmp/whatever",
buildEventStreamDocument(itemSchema),
),
).rejects.toThrow(message);
});
});

test("an itemSchema in a document older than OAS 3.2 is refused", async () => {
const document = documentWith({
const document = buildEventStreamDocument({
type: "object",
properties: { data: { type: "string" } },
});
Expand Down
5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
check: typecheck lint fmt-check test dead-code
check: typecheck lint fmt-check test dead-code dupes

typecheck:
pnpm exec oxlint --type-aware --type-check
Expand All @@ -21,3 +21,6 @@ test:

dead-code:
pnpm exec fallow dead-code

dupes:
pnpm exec fallow dupes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@block65/rest-client": "^16.0.0",
"@block65/shared-config": "^0.6.0",
"@block65/shared-config": "^0.7.0",
"@block65/tsconfig": "^0.3.1",
"@hono/standard-validator": "^0.4.0",
"@types/node": "^26.6.3",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ minimumReleaseAgeExclude:
- "@block65/oxlint-tsgolint-linux-x64@7.0.200300"
- "@block65/oxlint-tsgolint@7.0.200300"
- "@block65/oxlint@1.83.0"
- "@block65/oxlint-plugin@0.12.1"
- "@block65/shared-config@0.6.0"
- "@block65/shared-config@0.7.0"
- "@block65/oxlint-plugin@0.13.0"
- "@block65/rest-client@16.0.0"

overrides:
Expand Down
Loading