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: require additional fields for historical imagery (require linz extension) #199

Merged
merged 6 commits into from
Dec 9, 2021

Conversation

amfage
Copy link
Contributor

@amfage amfage commented Dec 9, 2021

This is to require the linz extension in the historical-imagery extension. Also to require the processing:software field recommended by the linz extension, and to remove the summaries requirement from aerial-photo and film, as these are already required by the historical-imagery extension.

@amfage amfage marked this pull request as ready for review December 9, 2021 02:58
Copy link
Collaborator

@paulfouquet paulfouquet left a comment

Choose a reason for hiding this comment

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

The changes looks good to me. Just one question about the unit tests.

@@ -30,6 +30,18 @@ o.spec('Aerial Photo Extension Collection', () => {
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
});

o('Missing summaries section should pass validation', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure to understand why this test. Did you add it because you've removed the summaries requirement in the schema?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, and I thought it would be good to check that it doesn't creep back in at some point. We want to keep these extensions as "light" as possible to make them easier for other people to use.

Copy link
Collaborator

@paulfouquet paulfouquet Dec 9, 2021

Choose a reason for hiding this comment

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

We want to keep these extensions as "light" as possible to make them easier for other people to use.

Totally agreed!

My question was focus on the unit test - as this tests that a non required field missing is not failing the validation and I did not understand why a test on this field when there are other non required fields that don't have a similar test. But I understand your point of view:

I thought it would be good to check that it doesn't creep back in at some point.

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically it's a regression test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What is you point of view on regression tests @l0b0 ? Should they stay there for good? Should we tag them for the code understanding later?

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting question. I'll try to answer with some personal "testing logic":

  1. The example file should contain examples of all the properties defined by the extension. Otherwise, what's the point?
  2. The first test shows that the file with all the properties is valid, to make sure we have a sane baseline.
  3. Subsequent tests show how this baseline can and can't be changed. By removing a mandatory property and asserting that the result fails validation we've tested that it is in fact mandatory. By removing an optional property and asserting that the result passes validation we've tested that it is in fact optional.
  4. It follows that removing the tests for mandatory or optional properties allows bugs to sneak in unnoticed.

So even though this is a regression test, it's not "just" a regression test. It verifies a useful feature of the schema which is not verified by other tests, so it should probably stay there for the foreseeable future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great answer, thanks @l0b0 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the interesting discussion @paulfouquet and @l0b0 , very useful.

@amfage amfage added the automerge kodiak automerge label label Dec 9, 2021
@kodiakhq kodiakhq bot merged commit 839821f into master Dec 9, 2021
@kodiakhq kodiakhq bot deleted the feat/historical-imagery-new-requirements branch December 9, 2021 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge kodiak automerge label
Development

Successfully merging this pull request may close these issues.

4 participants