Skip to content

Commit

Permalink
LYNX-160: Rename queries to avoid conflicts with PWA package (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliseacornejo authored Apr 26, 2023
1 parent 65fd385 commit e18edcc
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/CustomerGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ enum AttributeEntityTypeEnum {
CUSTOMER_ADDRESS
}

type CustomerAttributeMetadata implements AttributeMetadataInterface @doc(description: "Customer attribute metadata.") {
type CustomerAttributeMetadata implements CustomAttributeMetadataInterface @doc(description: "Customer attribute metadata.") {
input_filter: InputFilterEnum @doc(description: "The template used for the input of the attribute (e.g., 'date').")
multiline_count: Int @doc(description: "The number of lines of the attribute value.")
sort_order: Int @doc(description: "The position of the attribute in the form.")
Expand Down
23 changes: 14 additions & 9 deletions app/code/Magento/EavGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
# See COPYING.txt for license details.

type Query {
customAttributeMetadata(attributes: [AttributeInput!]! @doc(description: "An input object that specifies the attribute code and entity type to search.")): CustomAttributeMetadata @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\CustomAttributeMetadata") @doc(description: "Return the attribute type, given an attribute code and entity type.") @cache(cacheIdentity: "Magento\\EavGraphQl\\Model\\Resolver\\Cache\\CustomAttributeMetadataIdentity")
attributesMetadata(attributes: [AttributeInput!]): AttributesMetadataOutput! @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesMetadata") @doc(description: "Retrieve EAV attributes metadata.")
customAttributeMetadata(attributes: [AttributeInput!]! @doc(description: "An input object that specifies the attribute code and entity type to search.")):
CustomAttributeMetadata
@resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\CustomAttributeMetadata")
@doc(description: "Return the attribute type, given an attribute code and entity type.")
@cache(cacheIdentity: "Magento\\EavGraphQl\\Model\\Resolver\\Cache\\CustomAttributeMetadataIdentity")
@deprecated(reason: "Use `customAttributeMetadataV2` query instead.")
customAttributeMetadataV2(attributes: [AttributeInput!]): AttributesMetadataOutput! @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesMetadata") @doc(description: "Retrieve EAV attributes metadata.")
attributesForm(type: String! @doc(description: "Form type")): AttributesFormOutput! @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesForm") @doc(description: "Retrieve EAV attributes associated to a frontend form.")
attributesList(entityType: AttributeEntityTypeEnum! @doc(description: "Entity type.")): AttributesMetadataOutput @resolver(class: "Magento\\EavGraphQl\\Model\\Resolver\\AttributesList") @doc(description: "Returns list of atributes metadata for given entity type.") @cache(cacheable: false)
}
Expand Down Expand Up @@ -46,7 +51,7 @@ input AttributeInput @doc(description: "Defines the attribute characteristics to
}

type AttributesMetadataOutput @doc(description: "Metadata of EAV attributes.") {
items: [AttributeMetadataInterface!]! @doc(description: "Requested attributes metadata.")
items: [CustomAttributeMetadataInterface!]! @doc(description: "Requested attributes metadata.")
errors: [AttributeMetadataError!]! @doc(description: "Errors of retrieving certain attributes metadata.")
}

Expand All @@ -61,7 +66,7 @@ enum AttributeMetadataErrorType @doc(description: "Attribute metadata retrieval
UNDEFINED @doc(description: "Not categorized error, see the error message.")
}

interface AttributeMetadataInterface @typeResolver(class: "Magento\\EavGraphQl\\Model\\TypeResolver\\AttributeMetadata") @doc(description: "An interface containing fields that define the EAV attribute."){
interface CustomAttributeMetadataInterface @typeResolver(class: "Magento\\EavGraphQl\\Model\\TypeResolver\\AttributeMetadata") @doc(description: "An interface containing fields that define the EAV attribute."){
uid: ID! @doc(description: "The unique ID of an attribute. Based on entity type and attribute code")
code: String! @doc(description: "The unique identifier for an attribute code. This value should be in lowercase letters without spaces.")
label: String @doc(description: "The label assigned to the attribute.")
Expand All @@ -70,20 +75,20 @@ interface AttributeMetadataInterface @typeResolver(class: "Magento\\EavGraphQl\\
is_required: Boolean! @doc(description: "Whether the attribute value is required.")
default_value: String @doc(description: "Default attribute value.")
is_unique: Boolean! @doc(description: "Whether the attribute value must be unique.")
options: [AttributeOptionInterface!]! @doc(description: "Attribute options.")
options: [CustomAttributeOptionInterface!]! @doc(description: "Attribute options.")
}

interface AttributeOptionInterface @typeResolver(class: "Magento\\EavGraphQl\\Model\\TypeResolver\\AttributeOption") {
interface CustomAttributeOptionInterface @typeResolver(class: "Magento\\EavGraphQl\\Model\\TypeResolver\\AttributeOption") {
uid: ID! @doc(description: "The unique ID of an attribute option.")
label: String! @doc(description: "The label assigned to the attribute option.")
value: String! @doc(description: "The attribute option value.")
is_default: Boolean @doc(description: "Is the option value default.")
}

type AttributeOptionMetadata implements AttributeOptionInterface @doc(description: "Base EAV implementation of AttributeOptionInterface.") {
type AttributeOptionMetadata implements CustomAttributeOptionInterface @doc(description: "Base EAV implementation of CustomAttributeOptionInterface.") {
}

type AttributeMetadata implements AttributeMetadataInterface @doc(description: "Base EAV implementation of AttributeMetadataInterface.") {
type AttributeMetadata implements CustomAttributeMetadataInterface @doc(description: "Base EAV implementation of CustomAttributeMetadataInterface.") {
}

enum AttributeEntityTypeEnum @doc(description: "List of all entity types. Populated by the modules introducing EAV entities.") {
Expand All @@ -109,7 +114,7 @@ enum AttributeFrontendInputEnum @doc(description: "EAV attribute frontend input
}

type AttributesFormOutput @doc(description: "Metadata of EAV attributes associated to form") {
items: [AttributeMetadataInterface!]! @doc(description: "Requested attributes metadata.")
items: [CustomAttributeMetadataInterface!]! @doc(description: "Requested attributes metadata.")
errors: [AttributeMetadataError!]! @doc(description: "Errors of retrieving certain attributes metadata.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BooleanTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -72,7 +72,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CustomerAddressAttributesTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -83,7 +83,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DateTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -81,7 +81,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FileTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -77,7 +77,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ImageTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -77,7 +77,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MultilineTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MultiselectTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
default_value
Expand Down Expand Up @@ -105,7 +105,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SelectTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
options {
Expand Down Expand Up @@ -90,7 +90,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StoreViewOptionsTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -140,7 +140,7 @@ public function testAttributeLabelsNoStoreViews(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down Expand Up @@ -193,7 +193,7 @@ public function testAttributeLabelsMultipleStoreViews(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down Expand Up @@ -231,7 +231,7 @@ public function testAttributeLabelsMultipleStoreViews(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TextTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -63,7 +63,7 @@ public function testTextField(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand All @@ -87,7 +87,7 @@ public function testErrorEntityNotFound(): void
{
$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [],
'errors' => [
[
Expand All @@ -111,7 +111,7 @@ public function testErrorAttributeNotFound(): void
{
$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [],
'errors' => [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TextareaTest extends GraphQlAbstract
{
private const QUERY = <<<QRY
{
attributesMetadata(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
customAttributeMetadataV2(attributes: [{attribute_code: "%s", entity_type: "%s"}]) {
items {
uid
code
Expand Down Expand Up @@ -82,7 +82,7 @@ public function testMetadata(): void

$this->assertEquals(
[
'attributesMetadata' => [
'customAttributeMetadataV2' => [
'items' => [
[
'uid' => $uid,
Expand Down

0 comments on commit e18edcc

Please sign in to comment.