ahmadnassri / node-har-validator

Extremely fast HTTP Archive (HAR) validator using JSON Schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor schemas to use $ref's rather than merging schemas in code

epoberezkin opened this issue · comments

Schemas are merged in the code here: https://github.com/ahmadnassri/har-validator/blob/master/src/schemas.js

Instead it could be done using $ref's, in which case it would be easier to see these connections right in the schemas.

Please let me know what you think.

admittedly this is a bit specific to is-my-json-valid and a bit of organization / sorting, with the ability to do sub-schema validation more easily as export ready functions: https://github.com/ahmadnassri/har-validator/blob/master/src/promise.js#L25-L79

if scenario can be addressed with a $ref approach, happy to consider?

There seems to be no centrally defined JSON-schema for HAR format, just different schema implementations in different libraries. Maybe it's worth separating in a separate repo?

Yes, definitely, you can easily access/validate against subschemas using $ref's

There seems to be no centrally defined JSON-schema for HAR format, just different schema implementations in different libraries. Maybe it's worth separating in a separate repo?

I was considering that as part of #38 as well

Well, I could do schema part of #38 :) imjv has some limited $ref support; given that this case is pretty simple it should be possible to refactor schemas and support imjv.

@ahmadnassri please let me know if you are ok with this schema separation - I would create the repo in my account and add you as an owner in both the repo and npm. Is that ok?

resolved with v3.3.0