mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
multiple punctuation fixes in docs (#614)
This commit is contained in:
parent
ddfd7cd0fe
commit
15e3d6e549
@ -146,7 +146,7 @@ Checkout all the example applications in the
|
||||
The documentation and community will help you troubleshoot most issues. If you have encountered a bug or need to get in touch with us, you can contact us using one of the following channels:
|
||||
|
||||
* Support & feedback: [Discord](https://discord.gg/3FNQnWj)
|
||||
* Issue & bug tracking: [Github issues](https://github.com/hasura/graphql-engine/issues)
|
||||
* Issue & bug tracking: [GitHub issues](https://github.com/hasura/graphql-engine/issues)
|
||||
* Follow product updates: [@HasuraHQ](https://twitter.com/hasurahq)
|
||||
* Talk to us on our [website chat](https://hasura.io)
|
||||
|
||||
|
@ -32,7 +32,7 @@ Query/Subscription syntax
|
||||
* - argument
|
||||
- false
|
||||
- Argument_
|
||||
- one or more of filter criteria, instructions for sort order or pagination
|
||||
- One or more of filter criteria, instructions for sort order or pagination
|
||||
|
||||
**E.g. QUERY**:
|
||||
|
||||
@ -186,7 +186,7 @@ JSONB operators:
|
||||
* - ``_has_keys_all``
|
||||
- ``?&``
|
||||
|
||||
(For more details on what these operators do, refer `Postgres docs <https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE>`_.)
|
||||
(For more details on what these operators do, refer to `Postgres docs <https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE>`_.)
|
||||
|
||||
Text related operators :
|
||||
|
||||
@ -242,4 +242,3 @@ PaginationExp
|
||||
.. parsed-literal::
|
||||
|
||||
limit: Integer [offset: Integer]
|
||||
|
||||
|
@ -20,8 +20,8 @@ Anonymous (not logged in) users
|
||||
Logged-in users
|
||||
---------------
|
||||
|
||||
- Create a role called ``user``
|
||||
- Access control rules in this case are usually dependent on a ``user_id`` or a ``owner_id`` column in your data model
|
||||
- Create a role called ``user``.
|
||||
- Access control rules in this case are usually dependent on a ``user_id`` or a ``owner_id`` column in your data model.
|
||||
- Setup a permission for insert/select/update/delete that uses said column. Eg: ``author_id: {_eq: "X-Hasura-User-Id"}`` for an article table.
|
||||
- Note that the ``X-Hasura-User-Id`` is a :doc:`dynamic session variable<./roles-variables>` that comes in from your :doc:`auth webhook's<./webhook>` response, or as a request as a header if you're testing.
|
||||
|
||||
@ -34,9 +34,9 @@ Managers of an organisation in a multi-tenant app
|
||||
|
||||
Suppose you have a multi-tenant application where managers of a particular organisation can see all of the data that belongs to the organisation. In this case, your data models will probably have an ``org_id`` column that denotes the organisation either in the same table or via a related table.
|
||||
|
||||
- Create a role called ``manager``
|
||||
- Create a role called ``manager``.
|
||||
- Create a permission for select, which has the condition: ``org_id: {_eq: "X-Hasura-Org-Id"}``.
|
||||
- ``X-Hasura-Org-Id`` is a :doc:`dynamic variable<./roles-variables>` that is returned by your :doc:`auth webhook <./webhook>` for an incoming GraphQL request
|
||||
- ``X-Hasura-Org-Id`` is a :doc:`dynamic variable<./roles-variables>` that is returned by your :doc:`auth webhook <./webhook>` for an incoming GraphQL request.
|
||||
|
||||
.. image:: ../../../img/graphql/manual/auth/org-manager-graphiql.png
|
||||
:class: no-shadow
|
||||
@ -48,12 +48,12 @@ Let's say the "ownership" or "visibility" information for a data model (table) i
|
||||
|
||||
- Create a relationship called collaborators from the article table.
|
||||
|
||||
- Array relationship (article has array of collaborators): ``article :: id → collaborator :: article_id``
|
||||
- Array relationship (article has array of collaborators): ``article :: id → collaborator :: article_id``.
|
||||
|
||||
- Create a role called ``collaborator``
|
||||
- Create a select permission on the ``article`` table, which has the condition: ``collaborators: {collaborator_id: {_eq: "X-Hasura-User_id"}}``
|
||||
- Create a role called ``collaborator``.
|
||||
- Create a select permission on the ``article`` table, which has the condition: ``collaborators: {collaborator_id: {_eq: "X-Hasura-User_id"}}``.
|
||||
|
||||
- This reads as: Allow the role collaborator to select if ``article.collaborators`` has a ``collaborator_id`` equal to that of ``X-Hasura-User-Id``
|
||||
- This reads as: Allow the role collaborator to select if ``article.collaborators`` has a ``collaborator_id`` equal to that of ``X-Hasura-User-Id``.
|
||||
|
||||
.. image:: ../../../img/graphql/manual/auth/collaborator-relationship.png
|
||||
:class: no-shadow
|
||||
@ -68,13 +68,13 @@ Case 1: Logged-in users and anonymous users can access the same GraphQL fields
|
||||
|
||||
In simple use-cases logged-in users and anonymous users might be able to fetch different rows (let's say because of a ``is_public`` flag) but have access to the same fields.
|
||||
|
||||
- ``anonymous`` role has a ``{is_public: {_eq: true}}`` select condition
|
||||
- ``anonymous`` role has a ``{is_public: {_eq: true}}`` select condition.
|
||||
|
||||
- This reads: Allow anyone to access rows that are marked public.
|
||||
|
||||
- ``user`` role has a ``_or: [{is_public: {_eq: true}}, {owner_id: {_eq: "X-Hasura-User-Id"}}]``
|
||||
- ``user`` role has a ``_or: [{is_public: {_eq: true}}, {owner_id: {_eq: "X-Hasura-User-Id"}}]``.
|
||||
|
||||
- This reads: Allow users to access any rows that are public, or that are owned by them
|
||||
- This reads: Allow users to access any rows that are public, or that are owned by them.
|
||||
|
||||
Case 2: Logged-in users and anonymous users have access to different fields
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -87,4 +87,4 @@ In this case, anonymous users might have access only to a subset of fields while
|
||||
|
||||
- ``user`` role has a ``{owner_id: {_eq: "X-Hasura-User-Id"}}`` and all the columns are marked as selected.
|
||||
|
||||
- This reads: Allow users to that are owned by them
|
||||
- This reads: Allow users to that are owned by them.
|
||||
|
@ -33,7 +33,7 @@ TL;DR
|
||||
1. The JWT must contain: ``x-hasura-default-role``, ``x-hasura-allowed-roles``
|
||||
in a custom namespace in the claims.
|
||||
2. Other optional ``x-hasura-*`` fields (required as per your defined
|
||||
permissions)
|
||||
permissions).
|
||||
3. You can send ``x-hasura-role`` as header in the request to indicate a
|
||||
different role.
|
||||
4. Send the JWT via ``Authorization: Bearer <JWT>`` header.
|
||||
@ -133,7 +133,7 @@ public keys are not yet supported.
|
||||
``key``
|
||||
^^^^^^^
|
||||
- Incase of symmetric key (i.e HMAC based key), the key as it is. (e.g -
|
||||
"abcdef...")
|
||||
"abcdef...").
|
||||
- Incase of asymmetric keys (RSA etc.), only the public key, in a PEM encoded
|
||||
string or as a X509 certificate.
|
||||
|
||||
@ -161,7 +161,7 @@ JWKs are not refreshed.
|
||||
- Auth0 publishes their JWK url at: ``https://<YOUR_AUTH0_DOMAIN>.auth0.com``.
|
||||
But Auth0 has a bug. See known issues: :ref:`auth0-issues`.
|
||||
- Firebase publishes their JWK url at:
|
||||
``https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com``
|
||||
``https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com``.
|
||||
|
||||
``claims_namespace``
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
@ -260,7 +260,7 @@ https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceacc
|
||||
But that is a non-standard format. Firebase also publishes the same certificates
|
||||
as proper JWK format under:
|
||||
|
||||
https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com
|
||||
https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com .
|
||||
|
||||
If you are using Firebase and Hasura, use this config:
|
||||
|
||||
|
@ -60,7 +60,7 @@ Column Definitions
|
||||
""""""""""""""""""
|
||||
|
||||
- **table_schema**:
|
||||
Captures information about the schema under which a relationship is created
|
||||
Captures information about the schema under which a relationship is created.
|
||||
- **table_name**:
|
||||
Captures name of the table/view under which a relationship is created.
|
||||
- **rel_name**:
|
||||
@ -100,7 +100,7 @@ Column Definitions
|
||||
""""""""""""""""""
|
||||
|
||||
- **table_schema**:
|
||||
Captures information about the schema under which a permission is created
|
||||
Captures information about the schema under which a permission is created.
|
||||
- **table_name**:
|
||||
Captures name of the table/view under which a permission is created.
|
||||
- **role_name**:
|
||||
@ -110,7 +110,7 @@ Column Definitions
|
||||
- **perm_def**:
|
||||
Captures information about how the permission is defined.
|
||||
|
||||
Whenever a query is made with the above role for the above table GraphQL Engine
|
||||
Whenever a query is made with the above role for the above table GraphQL engine
|
||||
will first validate the requested columns with the columns which the user has access to using the ``columns`` key.
|
||||
Once the query is validated the appropriate results are returned after applying the filter defined in the ``filter``
|
||||
key.
|
||||
|
@ -9,16 +9,16 @@ for their handlers.
|
||||
|
||||
Why use serverless functions?
|
||||
-----------------------------
|
||||
1. Cost effectiveness
|
||||
2. No infra management
|
||||
3. Async business logic
|
||||
1. Cost effectiveness.
|
||||
2. No infra management.
|
||||
3. Async business logic.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
You can find a bunch of examples for various serverless cloud providers in this repo:
|
||||
|
||||
https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/serverless-triggers
|
||||
https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/serverless-triggers.
|
||||
|
||||
For example: update related data on a database event
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -61,4 +61,4 @@ Advanced:
|
||||
|
||||
This was a quickstart guide to get the Hasura GraphQL engine up and running
|
||||
quickly. For more detailed instructions on deploying using Docker, check out
|
||||
:doc:`../deployment/docker/index`
|
||||
:doc:`../deployment/docker/index`.
|
||||
|
@ -25,10 +25,10 @@ Setup an event trigger
|
||||
----------------------
|
||||
In the Hasura console, navigate to ``Events -> Create trigger`` and:
|
||||
|
||||
1. Enter trigger name as ``echo``
|
||||
2. Select table ``profile`` from the table dropdown
|
||||
3. Select operations: ``insert``, ``update`` and ``delete``
|
||||
4. Enter webhook URL as: ``https://httpbin.org/post``
|
||||
1. Enter trigger name as ``echo``.
|
||||
2. Select table ``profile`` from the table dropdown.
|
||||
3. Select operations: ``insert``, ``update`` and ``delete``.
|
||||
4. Enter webhook URL as: ``https://httpbin.org/post``.
|
||||
|
||||
.. image:: ../../../img/graphql/manual/getting-started/create-event-trigger.png
|
||||
|
||||
@ -52,4 +52,3 @@ Next steps
|
||||
Read more about:
|
||||
|
||||
- :doc:`Event triggers <../event-triggers/index>`
|
||||
|
||||
|
@ -47,4 +47,4 @@ Advanced:
|
||||
---------
|
||||
|
||||
This was a quickstart guide to get the Hasura GraphQL engine up and running quickly. For more detailed instructions
|
||||
on deploying using Heroku, check out :doc:`../deployment/heroku/index`
|
||||
on deploying using Heroku, check out :doc:`../deployment/heroku/index`.
|
||||
|
@ -103,7 +103,7 @@ Using jsonb operators
|
||||
Update using **_append** operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Update any ``jsonb`` column by appending it with given value. Since it is a json value, it should
|
||||
provided through a variable
|
||||
provided through a variable.
|
||||
|
||||
Append the ``extra_info`` of an article:
|
||||
|
||||
@ -148,7 +148,7 @@ variables for above query:
|
||||
Update using **_prepend** operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Update any ``jsonb`` column by prepending it with given value. Since it is a json value, it should
|
||||
provided through a variable
|
||||
provided through a variable.
|
||||
|
||||
Prepend the ``extra_info`` of an article:
|
||||
|
||||
@ -193,7 +193,7 @@ variables for above query:
|
||||
|
||||
Update using **_delete_key** operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Update any ``jsonb`` column by deleting a top level key. Input value should be a ``String``
|
||||
Update any ``jsonb`` column by deleting a top level key. Input value should be a ``String``.
|
||||
|
||||
Delete the key ``key3`` in the ``extra_info`` of an article:
|
||||
|
||||
@ -230,7 +230,7 @@ Delete the key ``key3`` in the ``extra_info`` of an article:
|
||||
|
||||
Update using **_delete_elem** operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Update any ``jsonb`` column by deleting a array element with given index value. Input value should be a ``Int``
|
||||
Update any ``jsonb`` column by deleting a array element with given index value. Input value should be a ``Int``.
|
||||
|
||||
Delete the element at ``2`` in ``jsonb`` array ``["a", "b", "c"]`` of column ``extra_info`` of an article:
|
||||
|
||||
@ -264,7 +264,7 @@ Delete the element at ``2`` in ``jsonb`` array ``["a", "b", "c"]`` of column ``e
|
||||
|
||||
Update using **_delete_at_path** operator
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Update any ``jsonb`` column by deleting field or element with specified path. Input value should be a ``String Array``
|
||||
Update any ``jsonb`` column by deleting field or element with specified path. Input value should be a ``String Array``.
|
||||
|
||||
Delete element at json path ``name.last`` in ``extra_info`` column of author table:
|
||||
|
||||
|
@ -129,4 +129,4 @@ Fetch a list of articles and the name of each article’s author:
|
||||
.. note::
|
||||
|
||||
The name of the nested object is the same as the name of the object or array relationship configured in the
|
||||
console
|
||||
console.
|
||||
|
@ -73,7 +73,7 @@ Fetch data about author whose ``id`` *(an integer field)* is equal to 3:
|
||||
|
||||
Example: String or Text
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Fetch a list of authors with ``name`` *(a text field)* as "Sidney"
|
||||
Fetch a list of authors with ``name`` *(a text field)* as "Sidney":
|
||||
|
||||
.. graphiql::
|
||||
:view_only:
|
||||
|
@ -17,8 +17,8 @@ The boilerplate includes sample custom resolvers for:
|
||||
|
||||
- A ``hello`` query which returns a fixed string.
|
||||
- A ``count`` query that returns a counter from some other data source.
|
||||
- A ``increment_counter`` mutation that increments the value of the above counter
|
||||
- A ``user_average_age`` query that directly makes an SQL query to Postgres using Knex and returns the result
|
||||
- A ``increment_counter`` mutation that increments the value of the above counter.
|
||||
- A ``user_average_age`` query that directly makes an SQL query to Postgres using Knex and returns the result.
|
||||
|
||||
The steps to achieve this are:
|
||||
|
||||
@ -28,4 +28,3 @@ The steps to achieve this are:
|
||||
- Merge this schema with the existing Hasura GraphQL schema and serve the resulting GraphQL API.
|
||||
|
||||
The above steps are implemented using `Apollo's graphql-tools library <https://github.com/apollographql/graphql-tools>`__.
|
||||
|
||||
|
@ -34,7 +34,7 @@ Open the console and head to ``Data -> article -> Modify``:
|
||||
|
||||
CREATE SEQUENCE roll_number_seq;
|
||||
|
||||
Now set the default value of the ``roll_number`` field as ``nextval('roll_number_seq')``
|
||||
Now set the default value of the ``roll_number`` field as ``nextval('roll_number_seq')``.
|
||||
|
||||
|
||||
2) Run an insert mutation
|
||||
@ -48,4 +48,4 @@ value will be set automatically by Postgres.
|
||||
.. note::
|
||||
|
||||
The default value is ignored when a value is explicity set to the field. To enforce the value set in a field is the
|
||||
result of the defined SQL function, see: :doc:`sql-functions`
|
||||
result of the defined SQL function, see: :doc:`sql-functions`.
|
||||
|
@ -247,4 +247,4 @@ Renaming relationships
|
||||
To rename a relationship, head to ``Data -> [table-name] -> Relationships`` in the console, drop the existing
|
||||
relationship and recreate it with the new name.
|
||||
|
||||
**Note:** You might not be allowed to drop a relationship if it has been referenced elsewhere (e.g. in a permissions rule)
|
||||
**Note:** You might not be allowed to drop a relationship if it has been referenced elsewhere (e.g. in a permissions rule).
|
||||
|
@ -88,7 +88,7 @@ The GraphQL query to fetch this weather information would look like:
|
||||
}
|
||||
}
|
||||
|
||||
Explore this API on `Apollo LaunchPad <https://launchpad.graphql.com/nxw8w0z9q7>`_
|
||||
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
|
||||
Postgres's ``person`` schema to include weather information based on the ``city`` column of the person table.
|
||||
|
@ -2,7 +2,7 @@ Troubleshooting Hasura GraphQL Engine Errors
|
||||
============================================
|
||||
|
||||
Hasura GraphQL engine may not work as expected and will throw unexpected errors if the tables/views tracked by
|
||||
the GraphQL engine are altered using ``psql`` or any other postgresql client.
|
||||
the GraphQL engine are altered using ``psql`` or any other PostgreSQL client.
|
||||
|
||||
Hasura GraphQL engine creates and maintains an **internal state** based on the database it is configured to use.
|
||||
This internal state will comprise of information about the tables/views, relationships and access control rules
|
||||
@ -21,7 +21,7 @@ database.
|
||||
For example, you will encounter the above error if you have:
|
||||
|
||||
- Created/tracked a table called ``author`` from console.
|
||||
- Opened ``psql`` or ``adminer`` or any other postgresql client and deleted ``author`` table.
|
||||
- Opened ``psql`` or ``adminer`` or any other PostgreSQL client and deleted ``author`` table.
|
||||
- Restarted GraphQL engine.
|
||||
|
||||
In this example, the GraphQL engine expects the table ``author`` to be available in the database to
|
||||
|
Loading…
Reference in New Issue
Block a user