naugtur / npm-audit-resolver

Apache License 2.0
121 stars 28 forks source link

Feature request: JSON schema for audit-resolve.json #76

Open jase88 opened 11 months ago

jase88 commented 11 months ago

Would be great to have a JSON schema of the audit-resolve.json that is applied initially.

like

{
  "$schema": "node_modules/npm-audit-resolver/schema.json",
  // ...
}

This would make clearer for devs which optional fields might be filled in (if there are any?) and third party tools could read the format easier.

naugtur commented 11 months ago

I'd happily accept a PR configuring that. Hit me up with any questions you need answered to do it.

On Wed, Dec 6, 2023, 10:23 jase @.***> wrote:

Would be great to have a JSON schema of the audit-resolve.json that is applied initially.

like

{ "$schema": "node_modules/npm-audit-resolver/schema.json", // ... }

This would make clearer for devs which optional fields might be filled in (if there are any?) and third party tools could read the format easier.

— Reply to this email directly, view it on GitHub https://github.com/naugtur/npm-audit-resolver/issues/76, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD4LP44H6OGG2HJ2UIM3QLYIA2RFAVCNFSM6AAAAABAJBR3UOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZDQMJQGU3TCOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jase88 commented 11 months ago

Hey, thanks.

I realized that there are already two JSON schemas within audit-resolve-core. Currently these are baked into a js files (e.g. auditFile/versions/v1.js).

First thought:

So the changes should probably only happen in audit-resolve-core, right? There is also the file writing happening, where the $schema needs to be applied as well

naugtur commented 10 months ago

Sounds about right. Just make sure it's not a breaking change and I'll take it. :)

Planning to do a release before year ends.

On Thu, Dec 7, 2023, 08:31 jase @.***> wrote:

Hey, thanks.

I realized that there are already two JSON schemas within audit-resolve-core. Currently these are baked into a js files (e.g. auditFile/versions/v1.js).

First thought:

  • move content of js files to schema.json files (for example v0.schema.json)
  • consume them within js files (require or readFileSync - also depending which node version should be supported)

So the changes should probably only happen in audit-resolve-core, right? There is also the file writing happening, where the $schema needs to be applied as well

— Reply to this email directly, view it on GitHub https://github.com/naugtur/npm-audit-resolver/issues/76#issuecomment-1844813240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD4LP6MGRFPGXXTSLKOBNLYIFWFPAVCNFSM6AAAAABAJBR3UOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBUHAYTGMRUGA . You are receiving this because you commented.Message ID: @.***>

jase88 commented 10 months ago

Ok great made a first PR containing a schema file