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

[Compiler] Requesting Schema Source Code #55

Closed
VaughnVernon opened this issue Oct 18, 2019 · 4 comments
Closed

[Compiler] Requesting Schema Source Code #55

VaughnVernon opened this issue Oct 18, 2019 · 4 comments
Assignees

Comments

@VaughnVernon
Copy link
Contributor

The following GET will crash in the compiler.

curl -i -X GET -H "Accept: application/json" http://localhost:9019/code/{reference}/{language}

Concrete example:

  1. Create each of Org:Unit:Context:Schema:Version
  2. Query for the source code
  3. Exception

E.g. /code/vlingo:PlatformDevelopment:io.vlingo.schemata:SchemaDefined:1.0.0/java

This is due to two problems:

  1. The compiler is unfinished reimplementation from synchronous to asynchronous
  2. There is no dependency resolver implementation; if one SchemaVersion has a dependency on another named SchemaVersion there is no way to resolve that dependency type.
  3. There is only an in-memory "mock" resolver: CacheTypeResolver
@VaughnVernon VaughnVernon changed the title BUG: Requesting Schema Source Code [Compiler] Requesting Schema Source Code Oct 18, 2019
@wwerner wwerner self-assigned this Oct 18, 2019
@VaughnVernon
Copy link
Contributor Author

@wwerner BTW, above There is only an in-memory "mock" resolver: CacheTypeResolver is already in #24.

@wwerner
Copy link
Contributor

wwerner commented Oct 18, 2019

I think the dependency resolver also requires #42 and touches on #18, which seems to have been updated in the meantime.

wwerner added a commit that referenced this issue Oct 18, 2019
@wwerner
Copy link
Contributor

wwerner commented Oct 18, 2019

Can be reproduced using the api calls in 3ba58f2#diff-aaf154ff3102258e75795d80b37a74c6R111

Preliminary analysis:

  • The issue only seems to occur when request gets dispatched by ResourceHandlerActor, a test against the compiler alone works fine (io.vlingo.schemata.codegen.specs.JavaCodeGenTests#testThatGeneratesABasicTypeWithAllConsideredInnerTypes)
  • io.vlingo.schemata.resource.CodeResource#queryCodeForLanguage fails w/ an NPE b/c its context (io.vlingo.http.resource.ResourceHandler#context) is null
  • The context gets set in io.vlingo.http.resource.ResourceRequestHandlerActor#handleFor (io.vlingo.http.Context, java.util.function.Consumer)) but is null in CodeResource handler executor
    image

What am I missing here?

Trying to temporarily work around the missing context shows that the Authorization would get validated afterwards in io.vlingo.schemata.query.CodeQueriesActor#validate. Currently, I can't see where the Authorization header would come from.

To reproduce in a unit/integration test, would it be good to spin up a server and run the api calls against it, or is there a smarter way?

@wwerner
Copy link
Contributor

wwerner commented Nov 11, 2019

Closed as of #60

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