Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Problem when generating Typescript interface from a fresh dev-main APIP core

Đang mở
#322 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
api, tooling

Hướng nghiên cứu

Tái hiện vấn đề với @api-platform/client-generator bằng lệnh và https://api.calico.dev được hiển thị ở đây, sau đó so sánh với API demo. Bắt đầu bằng cách theo dõi cách trình tạo xử lý phản hồi từ /contexts/Entrypoint, đặc biệt là mảng do curl trả về. Công việc được coi là hoàn tất khi API được báo cáo có thể tạo các interface TypeScript hoặc công cụ báo lỗi rõ ràng và có thể xử lý được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug TypeScript

API Platform version(s) affected: dev-main (v3)

Description
I try to generate typescript interfaces from client-generator tool it work sfind with the demo https://demo.api-platform.com/ but not with my personal instance but I can't make sense of the error message, any heap ?

node ➜ /srv/app/front $ npm run generate-types

> [email protected] generate-types
> NODE_TLS_REJECT_UNAUTHORIZED=0 npx @api-platform/client-generator --generator typescript https://api.calico.dev types/generated/ --resource Book
{
  api: Api { entrypoint: 'https://api.calico.dev', resources: [] },
  error: jsonld.InvalidUrl: Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.
      at ContextResolver._fetchContext (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/ContextResolver.js:186:13)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async ContextResolver._resolveRemoteContext (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/ContextResolver.js:117:34)
      at async ContextResolver.resolve (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/ContextResolver.js:50:22)
      at async api.process (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/context.js:65:20)
      at async api.expand (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/expand.js:211:17)
      at async Function.jsonld.expand (/home/node/.npm/_npx/5feb941c1afcc05f/node_modules/jsonld/lib/jsonld.js:331:18)
      at async Promise.all (index 1) {
    details: {
      code: 'invalid remote context',
      url: 'https://api.calico.dev/contexts/Entrypoint'
    }
  },
  response: undefined,
  status: undefined
}
node ➜ /srv/app/front $ curl https://api.calico.dev/contexts/Entrypoint
[{"@vocab":"https:\/\/api.calico.dev\/docs.jsonld#","hydra":"http:\/\/www.w3.org\/ns\/hydra\/core#","book":{"@id":"Entrypoint\/book","@type":"@id"}}]
Ngôn ngữ chính
TypeScript
Star
376
Fork
133
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của api-platform/create-client

Tất cả issue của api-platform/create-client

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.