hey-api / openapi-ts

✨ Turn your OpenAPI specification into a beautiful TypeScript client

Home Page:https://heyapi.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

schema compliance with jsr

wendrul opened this issue · comments

Description

Similar to #492 when generating schemas through openapi-ts, the jsr publish command complains as such:

$ npx jsr publis --dry-run

error[missing-explicit-type]: missing explicit type in the public API
   --> /home/wendrul/windmill-dev/jsr/typescript-client/src/schemas.gen.ts:543:14
    |
543 | export const $MySchema = {
    |              ^^^^^^^^^^^^^ this symbol is missing an explicit type
    = hint: add an explicit type annotation to the symbol

  info: all symbols in the public API must have an explicit type
  docs: https://jsr.io/go/slow-type-missing-explicit-type

as these are consts, we found that copying and pasting the value as a type is enough to make the error go away.

Generating schemas with explicit types is a (most likely) simple change that would help openapi-ts generated clients to be easily published and integrated to jsr.

more about jsr: https://jsr.io/#why-jsr

Hey @wendrul can you open a discussion at JSR and tag me in there too? I don't think it's right that we should be generating types for schemas. There's no mention of constants on that link either, only functions and classes.

Will do, and yeah we were also a little confused about why this applied to const

This turned out to be a bug in jsr. Backtick delimited string literals were marked as tagged template literals, flagging them as slow types.
jsr-io/jsr#447 (reply in thread)