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

fix type check on 2 args json #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

disberd
Copy link

@disberd disberd commented Jun 10, 2023

I started trying out this package to interact with the GitLab API on a self-hosted instance and encountered an error when trying to use the 2 argument @json macro to add things endpoints and types to the GitLabAPI.

I believe the type check in the 2 argument @json macro is wrong, as the APIs seems to be of type Forge rather than ForgeType.

This is based on the 1 argument definition of @json (which calls the same 2-argument function json as the 2-argument macro):

macro json(def::Expr)
forge = try
getfield(__module__, Symbol(string(nameof(__module__)) * "API"))
catch
throw("No forge struct named $forge. Make one or pass $(__module__)'s forge struct to @json $(def.args[2])")
end
json(forge, def)
end

which simply extracts the struct $(ModuleName)API which always seems of type Forge rather than ForgeType:

@disberd
Copy link
Author

disberd commented May 1, 2024

@christopher-dG, could check if this can be merged or point me to someone else for review?

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.

1 participant