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

Extensions are not required on catalogs #127

Merged
merged 2 commits into from
Jul 9, 2020

Conversation

jisantuc
Copy link
Contributor

@jisantuc jisantuc commented Jul 8, 2020

Overview

This PR makes stac_extensions optional when decoding catalogs.

Checklist

  • New tests have been added or existing tests have been modified
  • Changelog updated

Testing Instructions

  • make sure that everywhere we try to get a field named stac_extensions when decoding, we ask for an Option[List[String]] instead of a List[String]

Closes #121

@jisantuc
Copy link
Contributor Author

jisantuc commented Jul 8, 2020

Everywhere else we ask for extensions, we decode them as an optional list of strings, so this one was just an oversight 🤷‍♂️

Copy link

@notthatbreezy notthatbreezy left a comment

Choose a reason for hiding this comment

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

One comment that I don't feel strongly about, but wanted to make sure I understood the effects of this change.

@@ -58,7 +58,7 @@ object StacCatalog {
) =>
StacCatalog.apply(
version,
extensions,
extensions getOrElse Nil,

Choose a reason for hiding this comment

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

This limits the set of changes here to only the encoders/decoders - which is nice because it reduces the downstream dependencies. But one thing that I think happens as a result is if stac4s reads a catalog without stac_extensions it will always write the same object with an empty list.

Should we change the encoder to behave the same as the decoder so it's consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, but I also don't think that fields should be both optional and possibly empty lists 🤷‍♂️.

I can't think of a way that encoding an empty list will hurt anything. It might be annoying if you keep firing PATCHes at Franklin and despite your best efforts you just can't get rid of the stac_extensions field. I don't know.

Choose a reason for hiding this comment

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

yeah I agree - I wish it was just an empty list too. The approach here makes sense to me.

@jisantuc jisantuc merged commit 70d6fe2 into master Jul 9, 2020
@jisantuc jisantuc deleted the bugfix/js/extensions-not-required-on-catalogs branch July 9, 2020 15:48
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.

STAC Catalog JSON expected to include the "stac_extensions" property
2 participants