Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema namespaces #2

Closed
shuritch opened this issue Oct 12, 2023 · 1 comment · Fixed by #4
Closed

Schema namespaces #2

shuritch opened this issue Oct 12, 2023 · 1 comment · Fixed by #4
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@shuritch
Copy link
Member

shuritch commented Oct 12, 2023

Describe the problem

const entities = new Map();
entities.set('User', {
    type: 'object',
    properties: {
        job: 'string',
        name: 'string',
        tasks: { type: 'reference', many: 'Task' }, 
        currentTask: { type: 'reference', one: 'Task' }
    }
});

entities.set('Task', { type: 'object', properties: { ends: 'date',  name: 'string' } });

const date = () => ({
    kind: 'scalar',
    test: sample => new Date(sample) ? true : false, 
    // ... Other custom type logic 
});

const namespace = new Namespace({ date }, entities);
const plan = { type: 'object', properties: { users: { type: 'array', items: ['User'] } }  } // May be just 'User'
new Schema(plan, { namespace }); 
@shuritch shuritch added the enhancement New feature or request label Oct 12, 2023
@shuritch shuritch added this to the v1.0.0 milestone Oct 12, 2023
@shuritch shuritch self-assigned this Oct 12, 2023
@shuritch shuritch linked a pull request Oct 16, 2023 that will close this issue
5 tasks
@shuritch
Copy link
Member Author

Implemented at v0.1.0 version

@shuritch shuritch linked a pull request Oct 18, 2023 that will close this issue
5 tasks
@shuritch shuritch removed a link to a pull request Oct 18, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant