Fork me on GitHub
#ring-swagger
<
2016-02-04
>
ikitommi01:02:36

@jefmsmit you can't share the plumbing destructuring syntax as data, but you can either: a) use :query [params schema] which is effective a let-statement on query-params, have to destucture from params yourself or b) use :query-params at context, which effects all its child routes. Valid only if all childs accept same params.

ikitommi01:02:52

but you can define the schema for one field and reuse that over multiple :query-params. There is no default-handling in schema itself currently, but planning to add that to our schema-tools.

tangrammer14:02:12

Hi guys, sorry about the noise but I'm struggling trying to get json-schema having prismatic/schema

tangrammer14:02:58

with this simple schema

(s/defschema User {:id s/Str, 
                   :name s/Str
                   :address {:street s/Str
                             :city (s/enum :tre :hki)}})

tangrammer14:02:23

(json-schema/convert User {})

tangrammer14:02:30

=> {:$ref "#/definitions/User"}

tangrammer14:02:59

my final reason to have json-schema is for giving to the FE javascript guys for his side validation

tangrammer14:02:16

and I thought that I could generate this data having prismatic/schemas

tangrammer14:02:29

BTW: thanks for your work simple_smile

ikitommi14:02:42

hi. we seem to be missing a good public api for the schema->json schema conversion :O

ikitommi14:02:35

swagger spec doesn’t allow deeply nested schemas, so everything will be flattened a one-level deep scehema objects.

ikitommi14:02:40

and thanks.

ikitommi14:02:56

I’ll try to finD the right fn...

tangrammer14:02:03

fing = find ?

ikitommi14:02:15

yes, there isn’t a single function to do that, logic to do that is currently coupled in the swagger2 namespace (extract sub-schemas + create definitions of subschemas + create models).

tangrammer14:02:11

I'll open an issue maybe others (with more knowledge than me ) can help or have experience with this topic

tangrammer14:02:22

sorry but really lost in this area

tangrammer14:02:59

Have a good day @ikitommi !

ikitommi14:02:34

thanks for reporting, we definetely need that, just have to push more stuff from swagger2 to json-schema. Shoudn’t be a big thing.

ikitommi14:02:02

@tangrammer: that works, if you are in a hurry 😉