Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic node encoding + new formatters + various fixes #70

Merged
merged 20 commits into from
Feb 9, 2019

Commits on Feb 6, 2019

  1. Configuration menu
    Copy the full SHA
    0a8a07a View commit details
    Browse the repository at this point in the history
  2. KeyedEncoding: Add new string formatters, capitalized, lowercased, up…

    …percased
    
    Some helpers to deal with converting auto-generated codable String values for instance variables to match some common XML key coding standards to the commonly used Swift camel casing
    
    - capitalzied: convert first letter to uppercase
    - uppercased: All letters uppercased
    - lowercased: All letters lowercased
    
    Support all types that conform to StringProtocol rather than just String
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    ae4d50a View commit details
    Browse the repository at this point in the history
  3. SharedBoxProtocol: Generalize for any Box inheritance

    Use a type erased protocl inheritance strategy commonly used to provide default implimentation to avaoid issues with as? checks in generic protocols, while retaining reuse benefits of generic protocols
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    e65d30b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    99fde81 View commit details
    Browse the repository at this point in the history
  5. Element coding, remove empty brackets if element string value is empt…

    …y string
    
    In the case where a codable provides an empty string for the codable string value for an instance variable an empty bracket was inserted which is invalid XML.
    
    ```
    let attr = "bar"
    let value = "FOO"
    enum CodingKeys : String, CodingKey {
        case attr
        case value = ""
    }
    ```
    
    Will be useful for unkeyed objects that contain only attributes eg;
    ```xml
    <box attr="bar"><>FOO</></box>
    <!-- Would now correctly become -->
    <box attr="bar">FOO</box>
    ```
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    38b79a2 View commit details
    Browse the repository at this point in the history
  6. Add DynamicNodeEncoding protocol

    DynamicNodeEncoding allows easily adding the ability to choose if iVars should be attribute or element encoded by inheriting DynamicNodeEncoding and implimenting a single static function in any Codable class or struct.
    
    This is simpler than the current method that requires a global dynamic encoding closure for every XMLEncoder instance. This allows changing the encoding where the data models live, rather than the creator of the XMLEncoder instance needing to have knowledge of all the possible structs and classes that the encoder might encounter at init time.
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    0300dd1 View commit details
    Browse the repository at this point in the history
  7. XMLEncoder: Add both option to value encoding, refactor encoder

    - refactor element and attribute encoders to closures for easier code reuse
    - Added type alias for encoding closures for clarity
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    14549a6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f8c594a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2ee4b03 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f5f6f8d View commit details
    Browse the repository at this point in the history
  11. test: Add coding / decoding tests to DynamicNodeEncoding

    Had removed them since I was testing intrinsics with attributes. Needed to wrap cateogy value in an element tag again.
    
    Also appears the hack for decoding nested arrays is no longer required so removed the complex decoding of Category
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    e86be14 View commit details
    Browse the repository at this point in the history
  12. Convrted BooksTest to DynamicNodeEncoding, tests string equality

    Previous version of this test techncially passed on Encdode/Decode comparision sinve the structure values were the same, but the encoding make Book structs id an element, so the strings weren't equal.
    
    Modified the simplier single book test to check that the attributes are encoded to XML and match the original string (minus white space formatting)
    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    5e94557 View commit details
    Browse the repository at this point in the history
  13. Swiftfomat corrections

    JoeMatt committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    39b5999 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f5a8578 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a110b83 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    f60bb38 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    110a66b View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    2061b34 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2019

  1. Configuration menu
    Copy the full SHA
    d29ce8f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    32f58ee View commit details
    Browse the repository at this point in the history