[Container-tools] JSON Schema in Python Level 2

Pavel Odvody podvody at redhat.com
Wed Nov 4 13:54:21 UTC 2015


On Wed, 2015-11-04 at 08:36 -0500, Aaron Weitekamp wrote:
> On Wed, Nov 4, 2015 at 6:32 AM, Maciej Szulik <maszulik at redhat.com>
> wrote:
> > Both OpenShift and K8S rely on swagger library for generating
> > schemas
> > from Go code. I know there's a python counterpart [1] but I haven't
> > tried it, maybe it'll be helpful for you guys.
> > 
> +1. I would lean strongly towards current golang tools/patterns.
> 
> 
> >  Maciej
> > 
> > [1] https://github.com/digium/swagger-py/
> > 

If I understand Swagger correctly it works the other way around - you
write a specification and then let codegen create the code for you.

> > 
> > 
> > On 11/03/2015 05:13 PM, Vaclav Pavlin wrote:
> > > Hi all,
> > > 
> > > As you probably know, we are using JSON Schema in Nulecule to
> > > define the
> > > specification. This let's us validate the Nulecule file against
> > > the spec,
> > > but that's all right now.
> > > 
> > > There have been ideas to write a tool which will generate textual
> > > representation from the schema and potentially a tool which could
> > > generate
> > > template Nulecule file from the schema.
> > > 
> > > I always liked specs defined as structures in Go lang - they are
> > > easy to
> > > read and use. After a discussion with Pavel yesterday, he got an
> > > idea which
> > > got alive in his Github repository:
> > > 
> > > https://github.com/rh-scp/metadata/blob/python-schema-1/schema/py
> > > thon-impl.md
> > > 
> > > Basically a way how to define a specification through Python
> > > classes and
> > > annotation (similarly to what can be done in Golang). I think
> > > Nulecule
> > > would be a great fit for this "experiment". IOW, we should try to
> > > rework
> > > the spec to the form Pavel is proposing to be able to a) generate
> > > the spec
> > > from code, b) use that code in Atomic App directly c) generate
> > > the docs, d)
> > > be able to generate Go lang structures from it in the future (and
> > > thus make
> > > it easy for anybody to just build on top of the spec)
> > > 
> > > I'd like to propose it as a topic for this or next week Cabal and
> > > get
> > > someone assigned after the release.
> > > 
> > > Comments can be added here:
> > > 
> > > https://github.com/rh-scp/metadata/pull/2
> > > 
> > > 
> > > Cheers,
> > > Vašek
> > > 
> > > 


-- 
Pavel Odvody <podvody at redhat.com>
Software Engineer - EMEA ENG Developer Experience
5EC1 95C1 8E08 5BD9 9BBF 9241 3AFA 3A66 024F F68D
Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/container-tools/attachments/20151104/c1d58fb2/attachment.sig>


More information about the Container-tools mailing list