GithubHelp home page GithubHelp logo

Enchancment: GraphQL Support about 5e-srd-api HOT 5 CLOSED

5e-bits avatar 5e-bits commented on August 12, 2024 2
Enchancment: GraphQL Support

from 5e-srd-api.

Comments (5)

bagelbits avatar bagelbits commented on August 12, 2024 1

Thanks @ecshreve!

from 5e-srd-api.

bagelbits avatar bagelbits commented on August 12, 2024

@theone85ca on Discord is spearheading this one.

from 5e-srd-api.

bagelbits avatar bagelbits commented on August 12, 2024

I've actually taken this own because we're on MongoDB Atlas now that supports this.

from 5e-srd-api.

bagelbits avatar bagelbits commented on August 12, 2024

I've run into a blocker on this. Everything works except the spells table:

5e-database.5e-database.spells    <root>    InvalidType    unable to create type "SpellDamageDamage_at_character_level" because of no valid fields
5e-database.5e-database.spells    <root>    InvalidType    unable to create type "SpellDamageDamage_at_slot_level" because of no valid fields
5e-database.5e-database.spells    <root>    InvalidType    unable to create type "SpellHeal_at_slot_level" because of no valid fields

Here is the generated schema:

{
  "title": "spell",
  "properties": {
    "_id": {
      "bsonType": "objectId"
    },
    "area_of_effect": {
      "bsonType": "object",
      "properties": {
        "size": {
          "bsonType": "int"
        },
        "type": {
          "bsonType": "string"
        }
      }
    },
    "attack_type": {
      "bsonType": "string"
    },
    "casting_time": {
      "bsonType": "string"
    },
    "classes": {
      "bsonType": "array",
      "items": {
        "bsonType": "object",
        "properties": {
          "index": {
            "bsonType": "string"
          },
          "name": {
            "bsonType": "string"
          },
          "url": {
            "bsonType": "string"
          }
        }
      }
    },
    "components": {
      "bsonType": "array",
      "items": {
        "bsonType": "string"
      }
    },
    "concentration": {
      "bsonType": "bool"
    },
    "damage": {
      "bsonType": "object",
      "properties": {
        "damage_at_character_level": {
          "bsonType": "object",
          "properties": {
            "1": {
              "bsonType": "string"
            },
            "5": {
              "bsonType": "string"
            },
            "11": {
              "bsonType": "string"
            },
            "17": {
              "bsonType": "string"
            }
          }
        },
        "damage_at_slot_level": {
          "bsonType": "object",
          "properties": {
            "1": {
              "bsonType": "string"
            },
            "2": {
              "bsonType": "string"
            },
            "3": {
              "bsonType": "string"
            },
            "4": {
              "bsonType": "string"
            },
            "5": {
              "bsonType": "string"
            },
            "6": {
              "bsonType": "string"
            },
            "7": {
              "bsonType": "string"
            },
            "8": {
              "bsonType": "string"
            },
            "9": {
              "bsonType": "string"
            }
          }
        },
        "damage_type": {
          "bsonType": "object",
          "properties": {
            "index": {
              "bsonType": "string"
            },
            "name": {
              "bsonType": "string"
            },
            "url": {
              "bsonType": "string"
            }
          }
        }
      }
    },
    "dc": {
      "bsonType": "object",
      "properties": {
        "dc_success": {
          "bsonType": "string"
        },
        "dc_type": {
          "bsonType": "object",
          "properties": {
            "index": {
              "bsonType": "string"
            },
            "name": {
              "bsonType": "string"
            },
            "url": {
              "bsonType": "string"
            }
          }
        },
        "desc": {
          "bsonType": "string"
        }
      }
    },
    "desc": {
      "bsonType": "array",
      "items": {
        "bsonType": "string"
      }
    },
    "duration": {
      "bsonType": "string"
    },
    "heal_at_slot_level": {
      "bsonType": "object",
      "properties": {
        "1": {
          "bsonType": "string"
        },
        "2": {
          "bsonType": "string"
        },
        "3": {
          "bsonType": "string"
        },
        "4": {
          "bsonType": "string"
        },
        "5": {
          "bsonType": "string"
        },
        "6": {
          "bsonType": "string"
        },
        "7": {
          "bsonType": "string"
        },
        "8": {
          "bsonType": "string"
        },
        "9": {
          "bsonType": "string"
        }
      }
    },
    "higher_level": {
      "bsonType": "array",
      "items": {
        "bsonType": "string"
      }
    },
    "index": {
      "bsonType": "string"
    },
    "level": {
      "bsonType": "int"
    },
    "material": {
      "bsonType": "string"
    },
    "name": {
      "bsonType": "string"
    },
    "range": {
      "bsonType": "string"
    },
    "ritual": {
      "bsonType": "bool"
    },
    "school": {
      "bsonType": "object",
      "properties": {
        "index": {
          "bsonType": "string"
        },
        "name": {
          "bsonType": "string"
        },
        "url": {
          "bsonType": "string"
        }
      }
    },
    "subclasses": {
      "bsonType": "array",
      "items": {
        "bsonType": "object",
        "properties": {
          "index": {
            "bsonType": "string"
          },
          "name": {
            "bsonType": "string"
          },
          "url": {
            "bsonType": "string"
          }
        }
      }
    },
    "url": {
      "bsonType": "string"
    }
  }
}

from 5e-srd-api.

ecshreve avatar ecshreve commented on August 12, 2024

Just dropping this here so it doesn't get lost in discord (and because I'm forgetful)

Poked around with generating the graphql schema a bit tonight and i think i figured out the problem, in the graphql spec field names have to start with at least one uppercase or lowercase letter, and the field names in

Damage_at_character_level
Damage_at_slot_level
Heal_at_slot_level

are just integers. I did a find/replace for all of those and pre-pended them with an "a" just to check and was able to generate the graphql schema with no errors (just some warnings). http://spec.graphql.org/June2018/#sec-Names

from 5e-srd-api.

Related Issues (20)

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.