OxygenFramework / Oxygen.jl

💨 A breath of fresh air for programming web apps in Julia
https://oxygenframework.github.io/Oxygen.jl/
MIT License
409 stars 25 forks source link

Refactors globals and implements oxidise macro #158

Closed JanisErdmanis closed 7 months ago

JanisErdmanis commented 7 months ago

This pull request implements an oxidise macro that allows the creation of a module local context. An example of it's use is as follows:

module Example

using Oxygen; @oxidise

@get "/inside" function(req::Request)
    return "Hello from Inside"
end

end 

and run correspondingly in the following manner:

using Example
Example.serve(port=3424)

As can be seen, this fixes #156, #125, and #115.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (8fed3b9) 98.31% compared to head (0e568ab) 94.62%. Report is 1 commits behind head on master.

Files Patch % Lines
src/methods.jl 88.46% 9 Missing :warning:
src/core.jl 96.66% 4 Missing :warning:
src/cron.jl 96.66% 1 Missing :warning:
src/streamutil.jl 80.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #158 +/- ## ========================================== - Coverage 98.31% 94.62% -3.70% ========================================== Files 14 18 +4 Lines 1070 1098 +28 ========================================== - Hits 1052 1039 -13 - Misses 18 59 +41 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ndortega commented 7 months ago

It's failing with julia 1.6.6 due to this error:

source: https://github.com/JanisErdmanis/Oxygen.jl/blob/feature/oxidise/src/core.jl#L558

ERROR: LoadError: LoadError: syntax: invalid assignment location "; docspath, schemapath, schema" around /home/runner/work/Oxygen.jl/Oxygen.jl/src/core.jl:558

From a quick glace it just appears that this version doesn't support destructuring with that syntax