Skip to content

Commit

Permalink
refactor: use import attributes for JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Nov 11, 2024
1 parent e3c0427 commit 9d63156
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pages/api/v1/openapi.json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { APIRoute } from "astro";

import data from "./_openapi.json";
import data from "./_openapi.json" with { type: "json" };

export const GET: APIRoute = () =>
Response.json(data, {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/api/v1/years/[year].json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {
InferGetStaticPropsType,
} from "astro";

import { quotesByYearBySymbol } from "../symbols/[symbol]/[year].json";
import { quoteYears } from "./index.json";
import { quotesByYearBySymbol } from "../symbols/[symbol]/[year].json" with { type: "json" };
import { quoteYears } from "./index.json" with { type: "json" };

export const getStaticPaths = (() => {
return quoteYears.map((year) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/v1/years/index.json.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";

import { quotesByYearBySymbol } from "../symbols/[symbol]/[year].json";
import { quotesByYearBySymbol } from "../symbols/[symbol]/[year].json" with { type: "json" };

const quoteRecords = await getCollection("quoteRecords");

Expand Down

0 comments on commit 9d63156

Please sign in to comment.