Code Monkey home page Code Monkey logo

modelarium's People

Contributors

brunobg avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

modelarium's Issues

Generate query/type tests

We could generate feature tests for queries and types automatically. Perhaps something like:

foreach ($model) {
   if (exists query $model) {
     add method for queryItem;
   }
   if (exists query plural($model)) {
     add method for queryList;
   }
}

Cannot add id to table

Describe the bug
id: ID! @renderable(table: true) does not work. It's not added to the table (though it's on the query graphql) because id is a special field and not present in fields of the formularium model. so we can't print the id on the table.

Random conflicts with relationship attribute names

Describe the bug
Seeds break because they try to getRandom(). Two problems:

  1. keys (like posts) don't match db keys (post_id)
  2. getRandom() should be called only for relationship targets, not for sources

To Reproduce
Steps to reproduce the behavior: run test app.

Query building for item ignores input types

Describe the bug
inputs are ignored when the queryList is generated.

To Reproduce
Steps to reproduce the behavior:

extend type Query {
    stuffs(
        priceRange: PriceRange
    ): [Stuff!]
}

type PriceRange {
    min: Int
    max: Int
}

Better way to get Lighthouse definitions

Lighthouse definitions are currently (manually) exported to a graphql file that is bundled with Modelarium. That's error prone and requires a specific lighthouse version. Lighthouse outputs a full graphql build through graphql, but that mixes user directives, modelarium directives, etc.

It should be possible to build this at runtime and filter the namespaces to get an always trustworthy directive declaration.

Many-to-many seeding

Many-to-many relationships are not properly seeding. The individual models are generated and the code was fixed to avoid creating random values in getRandomData, but the pivot table is not being seeded.

The proper fix should be to write a seeder for that, using a loop with ->attach() for the target model.

Implement Schema's itemtype

itemtype is supported on Formularium on the HTML renderer. itemprop is already parsed on @renderable, but there's no parser on object that sets itemtype.

Implement Laravel migration patches

Migrations at this time generate a _patch_ file that is empty. We know the previous model and we can diff to see what changed, and then generate the actual patch code with new, changed or deleted fields.

Morph relationships are not datatyped correctly

Describe the bug
Morph relationships lose the morph targets when schema is processed. This means renderable and the datatype cannot validate it or generate graphql queries correctly.

We need to store the target types on the datatype relationship class so they can be accessed later.

Conflicts with lighthouse-graphql-passport-auth

Describe the bug

lighthouse-graphql-passport-auth has a migration 2019_11_19_000000_update_social_provider_users_table.php which expects the user table to already exists. This is run before the generated user table, which is dated 2020.

Mixed is reserved in php8


Run composer run-script test
> ./vendor/bin/phpunit --configuration phpunit.xml tests/
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

PHP Fatal error:  Cannot use 'Mixed' as class name as it is reserved in /home/runner/work/modelarium/modelarium/Modelarium/Types/Mixed.php on line 13
Script ./vendor/bin/phpunit --configuration phpunit.xml tests/ handling the test event returned with error code 255
Error: Process completed with exit code 255.

Migration with n:m relationships seems to create foreign keys

Describe the bug
Declaring a n:m relationship creates wrong foreign keys

To Reproduce
Steps to reproduce the behavior: declare a migrationForeign key on a belongsToMany directive:

type User {
  id: ID!
  projects: [Project!] @hasMany
}

type Project @migrationTimestamps {
    users: [User!]! @belongsToMany @migrationForeign(onDelete: "cascade", onUpdate: "cascade")
}

Expected behavior
A proper foreign key to user_to_projects. Actual behavior:

$table->foreign("user_id")->references("id")->on("users")->onDelete("cascade")->onUpdate("cascade");

graphql
see above

Additional context
Add any other context about the problem here.

Handle lighthouse extensions

@nest parsing bug, @deprecated conflicting

scalar Mixed @scalar(class: "Modelarium\\Types\\Mixed")

scalar RulesMessageMap @scalar(class: "Modelarium\\Types\\Mixed")

Relationship seeding is bugged

Describe the bug
Apparently the seeder always sets zero as id, despite creating the item.

To Reproduce
Steps to reproduce the behavior:

  1. Seed the db

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.