Skip to content

[@feathersjs/schema] Feathers schema associations using $ref may not be working #2675

@ejmudrak

Description

@ejmudrak

Steps to reproduce

When using $ref associations with @feathersjs/schema and compiling the app locally, it fails and gives an error about the association.

The error:

Error: can't resolve reference AlbumResult from id ArtistResult
    at Object.code (/app/node_modules/ajv/lib/vocabularies/core/ref.ts:19:39)
    at keywordCode (/app/node_modules/ajv/lib/compile/validate/index.ts:523:9)
    at /app/node_modules/ajv/lib/compile/validate/index.ts:228:21
    at CodeGen.code (/app/node_modules/ajv/lib/compile/codegen/index.ts:525:33)
    at CodeGen.block (/app/node_modules/ajv/lib/compile/codegen/index.ts:680:20)
    at schemaKeywords (/app/node_modules/ajv/lib/compile/validate/index.ts:228:9)
    at typeAndKeywords (/app/node_modules/ajv/lib/compile/validate/index.ts:161:3)
    at subSchemaObjCode (/app/node_modules/ajv/lib/compile/validate/index.ts:147:3)
    at subschemaCode (/app/node_modules/ajv/lib/compile/validate/index.ts:124:7)
    at KeywordCxt.subschema (/app/node_modules/ajv/lib/compile/validate/index.ts:491:5)

Here is a gist of my app's schema and hooks code, which is currently reproducing the error.

System configuration

Running Feathers in docker

Module versions (especially the part that's not working):
I may be in a unique position since I am running Feathers v4 for all but the@feathersjs/schema package, which is v5

    "@feathersjs/authentication": "^4.5.11",
    "@feathersjs/authentication-local": "^4.5.15",
    "@feathersjs/authentication-oauth": "^4.5.15",
    "@feathersjs/configuration": "^4.5.15",
    "@feathersjs/errors": "^4.5.11",
    "@feathersjs/express": "^4.5.11",
    "@feathersjs/feathers": "^4.5.11",
    "@feathersjs/schema": "^5.0.0-pre.23",
    "@feathersjs/socketio": "^4.5.15",
    "@feathersjs/transport-commons": "^4.5.11",

NodeJS version:
17.0.0
Operating System:
macOS Monterey 12.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions