When user makes relation between queries, it may be like:
let nodeQuery = SwiftOverpass.query(type: .node)
let wayQuery = nodeQuery.related(.way)
It will work correctly, but the method related(_:) may cause an error inside the API server if user codes like:
let nodeQuery = SwiftOverpass.query(type: .node)
let backwardsQuery = nodeQuery.related(.backwards) // invalid relationship(node-backwords)
As above, user can make wrong relationships(e.g. node-backwards, node-node etc.) easily. First, I made it can throw an error when it's going wrong way. But it seems better to be restructured.
I think the cause is sharing related(_:) in the all query classes which implement OverpassQuery. Therefore, I split up the method into dedicated methods(e.g. node(:_), way(:_), backwards(:_) etc.) and set them into proper classes. The details are in the PR #8.
This will be breaking changes for making query instances.
// before
let node = SwiftOverpass.query(type: .node)
let way = node.related(.way)
// after
let node = NodeQuery()
let way = node.way()
When user makes relation between queries, it may be like:
It will work correctly, but the method
related(_:)
may cause an error inside the API server if user codes like:As above, user can make wrong relationships(e.g. node-backwards, node-node etc.) easily. First, I made it can throw an error when it's going wrong way. But it seems better to be restructured.
I think the cause is sharing
related(_:)
in the all query classes which implementOverpassQuery
. Therefore, I split up the method into dedicated methods(e.g.node(:_)
,way(:_)
,backwards(:_)
etc.) and set them into proper classes. The details are in the PR #8.This will be breaking changes for making query instances.
Therefore, I'd like to have opinions/thoughts.