ajevans99 / swift-json-schema

Generate JSON Schema documents from Swift
MIT License
12 stars 5 forks source link

Drop Void in parsing output #20

Open ajevans99 opened 2 months ago

ajevans99 commented 2 months ago
JSONObject()
  .additionalProperties {
     JSONString()
   }
   .map(\.1)

Because object has no properties, it validates to Validated<Void, String>, then when additional properties adds to type, it becomes Validated<(Void, [String: String]), String>. This is the reason for the weird .map(\.1) in macro expansions.

Instead, void should probably just be dropped. So type is just Validated<[String: String], String>`. I think this can be done in the result builder, similar to swift parsing builder here