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

Consider making more use of enums/sum type objects to improve ability to catch typos etc. #33

Open
dpk opened this issue Nov 25, 2024 · 2 comments

Comments

@dpk
Copy link
Contributor

dpk commented Nov 25, 2024

Arose in #32 where I couldn’t understand while testing why requesting a bundle embed wasn’t working (it’s called bundles with an s).

In this case and maybe others we should consider adding an alternative interface based on Python objects where you get some kind of error when you misspell their names. (In the case of embeds the string-based interface is fine as a lower-level alternative which allows more flexibility in case e.g. upstream DSpace ever adds more embed types)

@kshepherd
Copy link
Collaborator

We should use the Link annotations as a reference, probably, see the links specified here:

https://github.com/DSpace/DSpace/blob/main/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/ItemRest.java

And the same constants are used in path mapping in the main repository for each resource type:

https://github.com/DSpace/DSpace/blob/main/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ItemRestRepository.java

We might even be able to come up with a generator to parse the REST server java and at least give us some enums/constants/maps to work with initially....

@kshepherd
Copy link
Collaborator

I think the linked PR for this comment is actually supposed to be #20 - it's true that search configs for #32 do use literal strings like 'default' but they are user-defined in XML config on the backend, so not something that we can really solve with enums (unlike modelling, types, etc which i agree we should solve with enums)

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

No branches or pull requests

2 participants