Skip to content

Commit

Permalink
Breaking: remove multi definition support
Browse files Browse the repository at this point in the history
Summary: Removes support for multiple fragments in a single `graphql` tag. This was part of an inconsistent API that we're trying to unify and simplify now.

Reviewed By: josephsavona, jstejada

Differential Revision: D14243576

fbshipit-source-id: 277af4eac3783a9cc73fe1beee3bdfe4cdc03bdf
  • Loading branch information
kassens authored and facebook-github-bot committed Feb 28, 2019
1 parent 955bdff commit fae6903
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 1,317 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ module.exports = RelayCompatContainer.createContainer(CompatProfile, {
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
ERROR:
Error: BabelPluginRelay: Expected exactly one fragment in the graphql tag referenced by the property user.
Error: BabelPluginRelay: Expected exactly one definition per graphql tag.
`;
exports[`matches expected output: error_unexpected-fragment.txt 1`] = `
Expand Down Expand Up @@ -612,7 +612,7 @@ const CompatCommentCreateMutation = graphql\`
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
ERROR:
Error: BabelPluginRelay: Expected exactly one operation (query, mutation, or subscription) per graphql tag.
Error: BabelPluginRelay: Expected exactly one definition per graphql tag.
`;
exports[`matches expected output: error_unexpected-operation.txt 1`] = `
Expand Down Expand Up @@ -642,7 +642,7 @@ module.exports = RelayCompatContainer.createContainer(CompatProfile, graphql\`
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
ERROR:
Error: BabelPluginRelay: Expected only fragments within this graphql tag.
Error: BabelPluginRelay: Expected exactly one definition per graphql tag.
`;
exports[`matches expected output: export-refetch-container.txt 1`] = `
Expand Down Expand Up @@ -1526,115 +1526,6 @@ module.exports = RelayCompatContainer.createContainer(CompatProfile, {
});
`;
exports[`matches expected output: no-object-many-fragments.txt 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
*/
'use strict';
const RelayCompatContainer = require('RelayCompatContainer');
const graphql = require('graphql');
const CompatProfile = () => null;
module.exports = RelayCompatContainer.createContainer(CompatProfile, graphql\`
fragment CompatProfile_user on User {
name
}
fragment CompatProfile_viewer on User {
name
}
\`);
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
*/
'use strict';
const RelayCompatContainer = require('RelayCompatContainer');
const graphql = require('graphql');
const CompatProfile = () => null;
module.exports = RelayCompatContainer.createContainer(CompatProfile, {
user: {
modern: function () {
return require("CompatProfile_user.graphql");
},
classic: function (RelayQL_GENERATED) {
return {
kind: "FragmentDefinition",
argumentDefinitions: [],
node: function () {
return {
children: [{
fieldName: "name",
kind: "Field",
metadata: {},
type: "String"
}, {
fieldName: "id",
kind: "Field",
metadata: {
isGenerated: true,
isRequisite: true
},
type: "ID"
}],
id: RelayQL_GENERATED.__id(),
kind: "Fragment",
metadata: {},
name: "CompatProfile_user",
type: "User"
};
}()
};
}
},
viewer: {
modern: function () {
return require("CompatProfile_viewer.graphql");
},
classic: function (RelayQL_GENERATED) {
return {
kind: "FragmentDefinition",
argumentDefinitions: [],
node: function () {
return {
children: [{
fieldName: "name",
kind: "Field",
metadata: {},
type: "String"
}, {
fieldName: "id",
kind: "Field",
metadata: {
isGenerated: true,
isRequisite: true
},
type: "ID"
}],
id: RelayQL_GENERATED.__id(),
kind: "Fragment",
metadata: {},
name: "CompatProfile_viewer",
type: "User"
};
}()
};
}
}
});
`;
exports[`matches expected output: query.txt 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
/**
Expand Down Expand Up @@ -1826,115 +1717,6 @@ module.exports = RelayCompatContainer.createContainer(CompatProfile, {
});
`;
exports[`matches expected output: simple-named-with-many-fragments.txt 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
*/
'use strict';
const RelayCompatContainer = require('RelayCompatContainer');
const graphql = require('graphql');
const CompatProfile = () => null;
module.exports = RelayCompatContainer.createContainer(CompatProfile, graphql\`
fragment CompatProfile on User {
name
}
fragment CompatProfile_viewer on User {
name
}
\`);
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
*/
'use strict';
const RelayCompatContainer = require('RelayCompatContainer');
const graphql = require('graphql');
const CompatProfile = () => null;
module.exports = RelayCompatContainer.createContainer(CompatProfile, {
data: {
modern: function () {
return require("CompatProfile.graphql");
},
classic: function (RelayQL_GENERATED) {
return {
kind: "FragmentDefinition",
argumentDefinitions: [],
node: function () {
return {
children: [{
fieldName: "name",
kind: "Field",
metadata: {},
type: "String"
}, {
fieldName: "id",
kind: "Field",
metadata: {
isGenerated: true,
isRequisite: true
},
type: "ID"
}],
id: RelayQL_GENERATED.__id(),
kind: "Fragment",
metadata: {},
name: "CompatProfile",
type: "User"
};
}()
};
}
},
viewer: {
modern: function () {
return require("CompatProfile_viewer.graphql");
},
classic: function (RelayQL_GENERATED) {
return {
kind: "FragmentDefinition",
argumentDefinitions: [],
node: function () {
return {
children: [{
fieldName: "name",
kind: "Field",
metadata: {},
type: "String"
}, {
fieldName: "id",
kind: "Field",
metadata: {
isGenerated: true,
isRequisite: true
},
type: "ID"
}],
id: RelayQL_GENERATED.__id(),
kind: "Fragment",
metadata: {},
name: "CompatProfile_viewer",
type: "User"
};
}()
};
}
}
});
`;
exports[`matches expected output: within-class-reference.txt 1`] = `
~~~~~~~~~~ INPUT ~~~~~~~~~~
/**
Expand Down
Loading

0 comments on commit fae6903

Please sign in to comment.