mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
fix typos and grammar in docs/manual/schema (#754)
This commit is contained in:
parent
0993740786
commit
b087734b2c
@ -6,7 +6,7 @@ Hasura GraphQL engine provides instant GraphQL APIs over the tables and views of
|
||||
auto-generating the CRUD resolvers. However, sometimes you might have to write custom resolvers to capture business
|
||||
logic that is unrelated to the database.
|
||||
|
||||
We have setup `this boilerplate project <https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/custom-resolvers>`_
|
||||
We have set up `this boilerplate project <https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/custom-resolvers>`_
|
||||
illustrating how to write your own custom GraphQL resolvers and merge them with the Hasura GraphQL engine's resolvers.
|
||||
|
||||
Follow the boilerplate's ``README.md`` for detailed instructions.
|
||||
|
@ -4,7 +4,7 @@ Setting default values for fields
|
||||
Let's say you want certain fields to have their values set automatically by Postgres if
|
||||
not explicitly passed. For example, an auto-incrementing id, a created_at timestamp, etc.
|
||||
|
||||
We can achieve this by setting a default value for the field which could either be a fixed value or a simple sql
|
||||
We can achieve this by setting a default value for the field which could either be a fixed value or a simple SQL
|
||||
function.
|
||||
|
||||
**Example:** Say we have a field ``created_at`` in a table ``article`` which we would want to be set to the current
|
||||
|
@ -32,7 +32,7 @@ mutations.
|
||||
Relationships or Connections
|
||||
----------------------------
|
||||
|
||||
Between one table/view and another table/view you can tell Hasura GraphQL engine to create a relationship or a
|
||||
Between one table/view and another table/view, you can tell Hasura GraphQL engine to create a relationship or a
|
||||
connection between
|
||||
their 2 nodes in a graph, using a particular column as a link. Often, you have foreign-key constraints that
|
||||
indicate a relationship and you can tell Hasura GraphQL engine to use that foreign-key constraint to create a
|
||||
|
@ -4,7 +4,7 @@ Schema
|
||||
Hasura GraphQL engine automatically generates your GraphQL schema and resolvers based on your tables/views
|
||||
in Postgres. **You don't need to write a GraphQL schema or resolvers.**
|
||||
|
||||
The Hasura console gives you UI tools that speed up your data-modelling process or working with your existing database.
|
||||
The Hasura console gives you UI tools that speed up your data-modeling process, or working with your existing database.
|
||||
The console also automatically generates migrations or metadata files that you can edit directly and check into your
|
||||
version control.
|
||||
|
||||
|
@ -35,7 +35,7 @@ Here are examples to create relationships using the two methods:
|
||||
|
||||
.. image:: ../../../../img/graphql/manual/schema/add-foreign-key.png
|
||||
|
||||
**2) Create object relationship**
|
||||
**2) Create an object relationship**
|
||||
|
||||
Each article has one author. This is an ``object relationship``. The console
|
||||
infers this using the foreign-key and recommends the potential relationship in the ``Relationships`` tab
|
||||
@ -94,7 +94,7 @@ Here are examples to create relationships using the two methods:
|
||||
}
|
||||
}
|
||||
|
||||
**3) Create array relationship**
|
||||
**3) Create an array relationship**
|
||||
|
||||
An author can write multiple articles. This is an ``array relationship``.
|
||||
|
||||
|
@ -90,7 +90,7 @@ The GraphQL query to fetch this weather information would look like:
|
||||
|
||||
Explore this API on `Apollo LaunchPad <https://launchpad.graphql.com/nxw8w0z9q7>`_.
|
||||
|
||||
Note the usage of ``city_name`` as an argument for ``cityWeather`` query. Using this we can extend our original
|
||||
Note the usage of ``city_name`` as an argument for the ``cityWeather`` query. Using this we can extend our original
|
||||
Postgres's ``person`` schema to include weather information based on the ``city`` column of the person table.
|
||||
|
||||
.. code-block:: graphql
|
||||
@ -102,7 +102,7 @@ Postgres's ``person`` schema to include weather information based on the ``city`
|
||||
We have extended the type person to have one more field called ``city_weather``. This will resolve to the weather
|
||||
schema defined above and the respective resolver will return appropriate data.
|
||||
|
||||
The source code for the custom resolver can be found on github - `graphql-schema-stitching-demo
|
||||
The source code for the custom resolver can be found on GitHub - `graphql-schema-stitching-demo
|
||||
<https://github.com/hasura/graphql-schema-stitching-demo>`_. Note the usage of ``mergeSchemas``, a
|
||||
``graphql-tools`` utility that enables schema stitching.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user