openapi-examples-validator icon indicating copy to clipboard operation
openapi-examples-validator copied to clipboard

Opening for extension

Open bartoszm opened this issue 2 years ago • 7 comments

Two extension points added:

  • to provision own validator instance
  • to provision spec postprocessor

Fixes #188

bartoszm avatar Sep 27 '23 15:09 bartoszm

Be aware that the API is not officially supported. This tool is a CLI-tool in the first place. When changes are made and the API is affected by them, it will not be reflected in the semantic versioning. If you intend to use the API it is on your own risk.

However, I don't mind having this as an extension, but you will have to add automated tests and best with one or more meaningful use-cases, before it will be merged. Also, consequently the new properties should be available on all validate-functions then.

codekie avatar Sep 28 '23 14:09 codekie

I have enabled the API extension for all methods of public API. Added some simple tests. For validatorFactory it is a clone of index.js test with a custom Ajv instance For schema modification, I show how you can use postprocessor to force readOnly validation as OAS defines it (basic variant from https://github.com/codekie/openapi-examples-validator/issues/114)

bartoszm avatar Oct 04 '23 14:10 bartoszm

Hi @codekie. I have rebased it on top of my previous contribution. Please let me know what you think.

bartoszm avatar Oct 10 '23 11:10 bartoszm

LGTM in general. Maybe consider to support the consumption of an array of post-processors (instead of just one) where the result of the predecessor passes the result as input to the next post-processor so that they can be chained. Would that make sense? What do you think?

Hi, it does make sense. But can be easily achieved by chaining functions externally. I have modified the test code to illustrate that. Maybe lets keep it as is for now?

bartoszm avatar Oct 20 '23 11:10 bartoszm

@codekie could you let me know what do you think about this MR ? what is missing / unclear ?

bartoszm avatar Dec 03 '23 08:12 bartoszm

@bartoszm sorry for the slow responses, but I've been very busy with ongoing projects the past weeks. I hope that I'll have time to have a closer look at this, this week. I'll address you if I have questions.

codekie avatar Dec 04 '23 11:12 codekie

@bartoszm sorry for the slow responses, but I've been very busy with ongoing projects the past weeks. I hope that I'll have time to have a closer look at this, this week. I'll address you if I have questions.

No worries, I've been there many times :)

bartoszm avatar Dec 05 '23 23:12 bartoszm