Skip to content

Commit

Permalink
Merge pull request #1182 from Shopify/release/2022-07-auto-generated
Browse files Browse the repository at this point in the history
Update Schema to `2022-07` Release
  • Loading branch information
cocoahero authored Jul 1, 2022
2 parents 963e9ff + ba50d23 commit a358f81
Show file tree
Hide file tree
Showing 65 changed files with 2,063 additions and 3,532 deletions.
224 changes: 88 additions & 136 deletions Buy.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Buy/Generated/Storefront.Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

extension Storefront {
enum Schema {
static let version = "2022-04"
static let version = "2022-07"
}
}
75 changes: 27 additions & 48 deletions Buy/Generated/Storefront/Article.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ extension Storefront {
/// Returns a metafield found by namespace and key.
///
/// - parameters:
/// - namespace: Container for a set of metafields (maximum of 20 characters).
/// - key: Identifier for the metafield (maximum of 30 characters).
/// - namespace: A container for a set of metafields.
/// - key: The identifier for the metafield.
///
@discardableResult
open func metafield(alias: String? = nil, namespace: String, key: String, _ subfields: (MetafieldQuery) -> Void) -> ArticleQuery {
Expand All @@ -204,48 +204,21 @@ extension Storefront {
return self
}

/// A paginated list of metafields associated with the resource.
/// The metafields associated with the resource matching the supplied list of
/// namespaces and keys.
///
/// - parameters:
/// - namespace: Container for a set of metafields (maximum of 20 characters).
/// - first: Returns up to the first `n` elements from the list.
/// - after: Returns the elements that come after the specified cursor.
/// - last: Returns up to the last `n` elements from the list.
/// - before: Returns the elements that come before the specified cursor.
/// - reverse: Reverse the order of the underlying list.
/// - identifiers: The list of metafields to retrieve by namespace and key.
///
@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")
@discardableResult
open func metafields(alias: String? = nil, namespace: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, _ subfields: (MetafieldConnectionQuery) -> Void) -> ArticleQuery {
open func metafields(alias: String? = nil, identifiers: [HasMetafieldsIdentifier], _ subfields: (MetafieldQuery) -> Void) -> ArticleQuery {
var args: [String] = []

if let namespace = namespace {
args.append("namespace:\(GraphQL.quoteString(input: namespace))")
}

if let first = first {
args.append("first:\(first)")
}

if let after = after {
args.append("after:\(GraphQL.quoteString(input: after))")
}

if let last = last {
args.append("last:\(last)")
}

if let before = before {
args.append("before:\(GraphQL.quoteString(input: before))")
}

if let reverse = reverse {
args.append("reverse:\(reverse)")
}
args.append("identifiers:[\(identifiers.map{ "\($0.serialize())" }.joined(separator: ","))]")

let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))"
let argsString = "(\(args.joined(separator: ",")))"

let subquery = MetafieldConnectionQuery()
let subquery = MetafieldQuery()
subfields(subquery)

addField(field: "metafields", aliasSuffix: alias, args: argsString, subfields: subquery)
Expand Down Expand Up @@ -378,10 +351,14 @@ extension Storefront {
return try Metafield(fields: value)

case "metafields":
guard let value = value as? [String: Any] else {
guard let value = value as? [Any] else {
throw SchemaViolationError(type: Article.self, field: fieldName, value: fieldValue)
}
return try MetafieldConnection(fields: value)
return try value.map { if $0 is NSNull { return nil }
guard let value = $0 as? [String: Any] else {
throw SchemaViolationError(type: Article.self, field: fieldName, value: fieldValue)
}
return try Metafield(fields: value) } as [Any?]

case "onlineStoreUrl":
if value is NSNull { return nil }
Expand Down Expand Up @@ -546,20 +523,18 @@ extension Storefront {
return field(field: "metafield", aliasSuffix: alias) as! Storefront.Metafield?
}

/// A paginated list of metafields associated with the resource.
@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")
open var metafields: Storefront.MetafieldConnection {
/// The metafields associated with the resource matching the supplied list of
/// namespaces and keys.
open var metafields: [Storefront.Metafield?] {
return internalGetMetafields()
}

@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")

open func aliasedMetafields(alias: String) -> Storefront.MetafieldConnection {
open func aliasedMetafields(alias: String) -> [Storefront.Metafield?] {
return internalGetMetafields(alias: alias)
}

func internalGetMetafields(alias: String? = nil) -> Storefront.MetafieldConnection {
return field(field: "metafields", aliasSuffix: alias) as! Storefront.MetafieldConnection
func internalGetMetafields(alias: String? = nil) -> [Storefront.Metafield?] {
return field(field: "metafields", aliasSuffix: alias) as! [Storefront.Metafield?]
}

/// The URL used for viewing the resource on the shop's Online Store. Returns
Expand Down Expand Up @@ -644,8 +619,12 @@ extension Storefront {
}

case "metafields":
response.append(internalGetMetafields())
response.append(contentsOf: internalGetMetafields().childResponseObjectMap())
internalGetMetafields().forEach {
if let value = $0 {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}
}

case "seo":
if let value = internalGetSeo() {
Expand Down
75 changes: 27 additions & 48 deletions Buy/Generated/Storefront/Blog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ extension Storefront {
/// Returns a metafield found by namespace and key.
///
/// - parameters:
/// - namespace: Container for a set of metafields (maximum of 20 characters).
/// - key: Identifier for the metafield (maximum of 30 characters).
/// - namespace: A container for a set of metafields.
/// - key: The identifier for the metafield.
///
@discardableResult
open func metafield(alias: String? = nil, namespace: String, key: String, _ subfields: (MetafieldQuery) -> Void) -> BlogQuery {
Expand All @@ -160,48 +160,21 @@ extension Storefront {
return self
}

/// A paginated list of metafields associated with the resource.
/// The metafields associated with the resource matching the supplied list of
/// namespaces and keys.
///
/// - parameters:
/// - namespace: Container for a set of metafields (maximum of 20 characters).
/// - first: Returns up to the first `n` elements from the list.
/// - after: Returns the elements that come after the specified cursor.
/// - last: Returns up to the last `n` elements from the list.
/// - before: Returns the elements that come before the specified cursor.
/// - reverse: Reverse the order of the underlying list.
/// - identifiers: The list of metafields to retrieve by namespace and key.
///
@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")
@discardableResult
open func metafields(alias: String? = nil, namespace: String? = nil, first: Int32? = nil, after: String? = nil, last: Int32? = nil, before: String? = nil, reverse: Bool? = nil, _ subfields: (MetafieldConnectionQuery) -> Void) -> BlogQuery {
open func metafields(alias: String? = nil, identifiers: [HasMetafieldsIdentifier], _ subfields: (MetafieldQuery) -> Void) -> BlogQuery {
var args: [String] = []

if let namespace = namespace {
args.append("namespace:\(GraphQL.quoteString(input: namespace))")
}

if let first = first {
args.append("first:\(first)")
}

if let after = after {
args.append("after:\(GraphQL.quoteString(input: after))")
}

if let last = last {
args.append("last:\(last)")
}

if let before = before {
args.append("before:\(GraphQL.quoteString(input: before))")
}

if let reverse = reverse {
args.append("reverse:\(reverse)")
}
args.append("identifiers:[\(identifiers.map{ "\($0.serialize())" }.joined(separator: ","))]")

let argsString: String? = args.isEmpty ? nil : "(\(args.joined(separator: ",")))"
let argsString = "(\(args.joined(separator: ",")))"

let subquery = MetafieldConnectionQuery()
let subquery = MetafieldQuery()
subfields(subquery)

addField(field: "metafields", aliasSuffix: alias, args: argsString, subfields: subquery)
Expand Down Expand Up @@ -281,10 +254,14 @@ extension Storefront {
return try Metafield(fields: value)

case "metafields":
guard let value = value as? [String: Any] else {
guard let value = value as? [Any] else {
throw SchemaViolationError(type: Blog.self, field: fieldName, value: fieldValue)
}
return try MetafieldConnection(fields: value)
return try value.map { if $0 is NSNull { return nil }
guard let value = $0 as? [String: Any] else {
throw SchemaViolationError(type: Blog.self, field: fieldName, value: fieldValue)
}
return try Metafield(fields: value) } as [Any?]

case "onlineStoreUrl":
if value is NSNull { return nil }
Expand Down Expand Up @@ -378,20 +355,18 @@ extension Storefront {
return field(field: "metafield", aliasSuffix: alias) as! Storefront.Metafield?
}

/// A paginated list of metafields associated with the resource.
@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")
open var metafields: Storefront.MetafieldConnection {
/// The metafields associated with the resource matching the supplied list of
/// namespaces and keys.
open var metafields: [Storefront.Metafield?] {
return internalGetMetafields()
}

@available(*, deprecated, message:"The `metafields` field will be removed in the future in favor of using [aliases](https://graphql.org/learn/queries/#aliases) with the `metafield` field.\n")

open func aliasedMetafields(alias: String) -> Storefront.MetafieldConnection {
open func aliasedMetafields(alias: String) -> [Storefront.Metafield?] {
return internalGetMetafields(alias: alias)
}

func internalGetMetafields(alias: String? = nil) -> Storefront.MetafieldConnection {
return field(field: "metafields", aliasSuffix: alias) as! Storefront.MetafieldConnection
func internalGetMetafields(alias: String? = nil) -> [Storefront.Metafield?] {
return field(field: "metafields", aliasSuffix: alias) as! [Storefront.Metafield?]
}

/// The URL used for viewing the resource on the shop's Online Store. Returns
Expand Down Expand Up @@ -450,8 +425,12 @@ extension Storefront {
}

case "metafields":
response.append(internalGetMetafields())
response.append(contentsOf: internalGetMetafields().childResponseObjectMap())
internalGetMetafields().forEach {
if let value = $0 {
response.append(value)
response.append(contentsOf: value.childResponseObjectMap())
}
}

case "seo":
if let value = internalGetSeo() {
Expand Down
Loading

0 comments on commit a358f81

Please sign in to comment.