Skip to content

Integration tests are failing #6

@chebykinn

Description

@chebykinn

Hi, I saw the error in CI:

 FAIL  tests/emitter-zod.test.ts [ tests/emitter-zod.test.ts ]
TypeError: Cannot read properties of undefined (reading 'OptionalPropertiesPetSchema')
 ❯ tsp-output/@typespec-tools/emitter-zod/output.ts:63:34
     61|     export const updatePetSchema = z
     62|       .function()
     63|       .args(z.number(), TypeSpec.OptionalPropertiesPetSchema)
       |                                  ^
     64|       .returns(
     65|         z.union([SinglePetResponseSchema, CommonNotFoundResponseSchema]),
 ❯ tsp-output/@typespec-tools/emitter-zod/output.ts:73:22
 ❯ tsp-output/@typespec-tools/emitter-zod/output.ts:46:20
 ❯ tests/emitter-zod.test.ts:2:31

It can be reproduced locally as well. It seems like there are two issues here:

  • OptionalPropertiesPetSchema is placed in a separate TypeSpec namespace, while it should be in PetStore.
  • There is a cyclic dependency between OptionalPropertiesPetSchema and PetStore because of the' kind' field used in the schema.

It seems that this comes from how Typespec handles the scopes, so what can we do with this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions