eclipsesource / eclipsesource/jsonforms

createDefaultValue does not use the default value in a $ref

Open
#2,570 1 comment 0 reactions 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Describe the bug

With this schema:

```ts
const schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"mydef": {
"type": "object",
"properties": {
"myprop": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"example": {
"$ref": "#/definitions/mydef",
"default": { "myprop": "default" }
}
}
}
```

### Expected behavior

`createDefaultValue(schema.properties.example, schema)` should return `{ myprop: "default" }`.

### Steps to reproduce the issue

`createDefaultValue(schema.properties.example, schema)` returns `{}`.

### Screenshots

_No response_

### Which Version of JSON Forms are you using?

v3.7.0

### Package

Core

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.