This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Idp.EctoHelpers do | |
| alias Ecto.Changeset | |
| @doc """ | |
| Transform `%Ecto.Changeset{}` errors to a map | |
| containing field name as a key on which validation | |
| error happened and it's formatted message. | |
| For example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| :error, | |
| %{ | |
| message: "Changeset errors occurred", | |
| code: :changeset_errors, | |
| errors: [ | |
| %{field: "error message"} | |
| ] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @permission_denied { | |
| :error, | |
| %{ | |
| message: gettext("Permission denied"), | |
| code: :permission_denied | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def add(field_name, type, **options): | |
| pass | |
| def create_index(field_name): | |
| pass | |
| def schema(table_name, *actions): | |
| return DatabaseTable(table_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Any, Dict | |
| from graphene_django.views import GraphQLView | |
| from graphql.error import GraphQLError | |
| from graph.format_error import format_error | |
| class MyGraphQLView(GraphQLView): | |
| @staticmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Dict, Any | |
| from graphql import GraphQLError | |
| def format_error(error: GraphQLError) -> Dict[str, Any]: | |
| """Extract field from ``error`` and return formatted error | |
| :param error: GraphQLError | |
| :return: mapping of fieldName -> error message | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue' | |
| import VueApollo from 'vue-apollo' | |
| import { ApolloClient } from 'apollo-client' | |
| import { HttpLink } from 'apollo-link-http' | |
| import { InMemoryCache } from 'apollo-cache-inmemory' | |
| import { GRAPHQL_ENDPOINT } from './config' | |
| const httpLink = new HttpLink({ | |
| // You should use an absolute URL here | |
| uri: GRAPHQL_ENDPOINT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| chainWebpack: config => { | |
| config.module | |
| .rule('graphql') | |
| .test(/\.gql$/) | |
| .use('graphql-tag/loader') | |
| .loader('graphql-tag/loader') | |
| .end() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path') | |
| const { | |
| hasYarn, | |
| IpcMessenger, | |
| } = require('@vue/cli-shared-utils') | |
| const chalk = require('chalk') | |
| const { defaultValue, nullable } = require('./utils') | |
| const DEFAULT_SERVER_FOLDER = './apollo-server' | |
| const COMMAND_OPTIONS = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function posix-source | |
| for i in (cat $argv) | |
| set arr (echo $i |tr = \n) | |
| set -gx $arr[1] $arr[2] | |
| end | |
| end |