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

feat(jex): more unit tests + no more throwing when parsing json-schema #433

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

franklevasseur
Copy link
Member

@franklevasseur franklevasseur commented Oct 17, 2024

I was working on intersections, and I realized I had a lot of unrelated changes and refactors so I opened this intermediate PR

@franklevasseur franklevasseur requested a review from a team as a code owner October 17, 2024 00:55
@@ -2,67 +2,61 @@ import { JSONSchema7 } from 'json-schema'
import { test, expect } from 'vitest'
import { JexIR } from './typings'
import { fromJsonSchema as j2x } from './from-json-schema'
import { jexEquals as jexEquals } from '../jex-equals'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I wanted to make this test suite more unit or isolated. So I removed usage of jexEquals which is tested on its own

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Instead of throwing when mapping from json-schema to jexir-schema, I decided to fallback to unknown, when I can't handle a situation

let jexA = await jexir.fromJsonSchema(a)
let jexB = await jexir.fromJsonSchema(b)
jexA = jexir.normalize(jexA)
jexB = jexir.normalize(jexB)
return jexExtends(jexA, jexB)
}

export const jsonSchemaMerge = async (a: JSONSchema, b: JSONSchema): Promise<JSONSchema> => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I don't remember the purpose of this function

@franklevasseur franklevasseur merged commit e056793 into master Oct 17, 2024
1 check passed
@franklevasseur franklevasseur deleted the fl_jex_traverse branch October 17, 2024 01:26
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

Successfully merging this pull request may close these issues.

2 participants