Skip to content

prefix or public keys break meta #8335

Closed
@igorlukanin

Description

@igorlukanin

Describe the bug
This data model file compiles successfully:

cubes:
  - name: meta_prefix
    sql: SELECT 123

    measures:
      - name: count
        type: count
        meta: 
          my_prefix: qwerty

However, the following data model file would not compile (take a close look at meta):

cubes:
  - name: meta_prefix
    sql: SELECT 123

    measures:
      - name: count
        type: count
        meta: 
          prefix: qwerty

It emits the following error:

cubes/meta_prefix.yml:8
        "prefix": qwerty
                  ^

ReferenceError: qwerty is not defined
    at cubes/meta_prefix.yml:8:19
    at Script.runInContext (node:vm:133:12)
    at Script.runInNewContext (node:vm:138:17)
    at Object.runInNewContext (node:vm:290:38)
    at DataSchemaCompiler.compileJsFile (/node_modules/@cubejs-backend/schema-compiler/src/compiler/DataSchemaCompiler.js:256:10)
    at /node_modules/@cubejs-backend/schema-compiler/src/compiler/YamlCompiler.ts:101:36
    at Array.forEach (<anonymous>)
    at YamlCompiler.compileYamlFile (/node_modules/@cubejs-backend/schema-compiler/src/compiler/YamlCompiler.ts:99:31)
    at DataSchemaCompiler.compileFile (/node_modules/@cubejs-backend/schema-compiler/src/compiler/DataSchemaCompiler.js:245:25)
    at /node_modules/@cubejs-backend/schema-compiler/src/compiler/DataSchemaCompiler.js:195:14

Apparently, there's an issue with data model validation: prefix is not accepted inside meta if it has a value of the string type. Passing a boolean or a numeric value works.

Might be related to how Cube validates prefix inside views (docs).

Expected behavior
It should be allowed to use prefix inside meta on cube/view members.

Version:
0.35.45

Additional context
Reported in Slack: https://cube-js.slack.com/archives/C04NYBJP7RQ/p1717591569187009

Metadata

Metadata

Assignees

Labels

bugLEGACY. Use the Bug issue type insteaddata modeling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions