fritzy / fritzy/VeryModel

submodals with static throw error on create

Open
#32 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
55
Forks
11
PR merge metrics
No merged PRs in 30d

Description

``` javascript
var MyModel = new verymodel.Model({
id: {type: 'string', static: true},
owner: {model: {
owner_id: {type: 'string', static: true}
}}
});

var model = MyModel.create({
id: 'foobar',
owner: {
owner_id: 'fizzbuzz'
}
});

// Error: Cannot set static values
// at Object.owner_id (…/node_modules/verymodel/lib/model.js:347:27)
```

Identified in https://github.com/cloudflare/node-cloudflare/issues/2

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduction in the issue and inspect lib/model.js around line 347, where the nested owner_id assignment raises the error. Verify the behavior with the shown MyModel.create call. Done means creating the model with static values in the nested submodel no longer throws the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.