Validate input fields have unique names

This commit is contained in:
2020-09-24 05:47:31 +02:00
parent e9a94147fb
commit 9bfa2aa7e8
10 changed files with 84 additions and 30 deletions

View File

@ -487,11 +487,12 @@ nullValue :: Parser Text
nullValue = symbol "null" <?> "NullValue"
objectField :: Parser a -> Parser (ObjectField a)
objectField valueParser = ObjectField
<$> name
<* colon
<*> valueParser
<?> "ObjectField"
objectField valueParser = label "ObjectField" $ do
location <- getLocation
fieldName <- name
colon
fieldValue <- valueParser
pure $ ObjectField fieldName fieldValue location
variableDefinitions :: Parser [VariableDefinition]
variableDefinitions = listOptIn parens variableDefinition