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

What's broken? #17

Open
concaf opened this issue Dec 14, 2017 · 3 comments
Open

What's broken? #17

concaf opened this issue Dec 14, 2017 · 3 comments

Comments

@concaf
Copy link
Contributor

concaf commented Dec 14, 2017

@surajssd @surajnarwade what are currently broken things for us to generate a valid JSON Schema? Would be great to have a consolidated view!

@kadel
Copy link
Member

kadel commented Dec 14, 2017

for example #15 or #14 or #13 more at https://github.com/kedgeproject/json-schema-generator/issues ;-)

@surajssd
Copy link
Member

Condition today:


Right now the openapi2jsonschema which is used to generate configs is based off of my branch which has changes added to generate only controllers we care about like deploymentconfig jobspec etc

Now I have created a docker image surajd/openapi2jsonschema:generate-configs-for-kedge which is based off fedora because later on we will be using this image to install npm tool to convert openshift swagger v1 to openapi schema and doing it in openapi2jsonschema's alpine based image was really troublesome.

Dockerfile is also changed and is available here.

Link to my branch https://github.com/surajssd/openapi2jsonschema/tree/generate-configs-for-kedge


Once OpenShift gives you openapi spec and not old swagger then we can remove the whole part where we are doing conversion from swagger v1 to openapi

Code to do that is in Dockerfile for installing npm and that tool which does the conversion.

And in entrypoint script where we are actually doing the conversion.


Once we solve the above problem we don't need the fedora image we can use the upstream image garethr/openapi2jsonschema that is automatically built. But if you use the upstream image the problem is that you will lose out on the custom code that I have added to only generate configs we care about as pointed in the first section.


So right now the way to go forward is to generate the configs right now and edit it manually.


How do you know if your jsonschema is wrong?

Write a kedge json-schema acceptance test framwork. So what this will do is take your jsconschema as one input and another input is the examples in the kedge upstream repo. Since we know all the examples in the kedge repo are correct the jsonschema should validate those configs without error. If jsonschema validation fails then fix it manually. So after you setup this framework, run it on travis so that all changes are checked.


@concaf
Copy link
Contributor Author

concaf commented Dec 19, 2017

Thank you so much @surajssd, very helpful!


Right now the openapi2jsonschema which is used to generate configs is based off of my branch which has changes added to generate only controllers we care about like deploymentconfig jobspec etc

Link to my branch https://github.com/surajssd/openapi2jsonschema/tree/generate-configs-for-kedge

  • This should be fixed to out of the openapi2jsonschema tool, need to fix that.

Dockerfile is also changed and is available here.

  • Need to remove this as well once the above task is done

Once OpenShift gives you openapi spec and not old swagger then we can remove the whole part where we are doing conversion from swagger v1 to openapi

Code to do that is in Dockerfile for installing npm and that tool which does the conversion.

And in entrypoint script where we are actually doing the conversion.

  • Probably a noop for now since this is blocked on upstream. Should be fine as long as this approach works.

Once we solve the above problem we don't need the fedora image we can use the upstream image garethr/openapi2jsonschema that is automatically built. But if you use the upstream image the problem is that you will lose out on the custom code that I have added to only generate configs we care about as pointed in the first section.

  • Should be fixed with the first TODO

How do you know if your jsonschema is wrong?

Write a kedge json-schema acceptance test framwork. So what this will do is take your jsconschema as one input and another input is the examples in the kedge upstream repo. Since we know all the examples in the kedge repo are correct the jsonschema should validate those configs without error. If jsonschema validation fails then fix it manually. So after you setup this framework, run it on travis so that all changes are checked.

  • the end unicorn goal, cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants