question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Validation discrepancy between classpath model and imported model

See original GitHub issue

When using the smithy-gradle-plugin to build/validate a model, if that model is pulled in via the classpath by existing in a model/ directory, then the validation errors for that model are different than if that model is explicitly imported via the smithy-build.json file.

Here’s an example minimal model that should produce a DANGER error (it doesn’t like teapots, unless something changes due to #1386):

$version: "1.0"
namespace aws.protocoltests.misc

use aws.protocols#restJson1
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

@restJson1
service MiscService {
    operations: [ResponseCodeRequiredOperation],
}

@http(method: "GET", uri: "/responseCodeRequiredOperation", code: 418)
operation ResponseCodeRequiredOperation {
    input: EmptyStructure,
    output: ResponseCodeRequiredOutput,
}

structure EmptyStructure {}

@output
structure ResponseCodeRequiredOutput {
    @required
    @httpResponseCode
    responseCode: Integer,
}

This model, if pulled in by existing in the models/ directory, emits a WARN due to the IDL version being 1, but does not emit the DANGER message. If instead, it is placed outside the models/ directory and referenced directly from the imports section of smithy-build.json, then the DANGER message is emitted and the build fails.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mtdowlingcommented, Dec 6, 2022

Ok thanks for checking. One thing that I did see when trying to repro this is that the output was weird and interleaving text across threads (due to the use of PrintStream instead of PrintWriter). This PR will fix that https://github.com/awslabs/smithy/pull/1525. I’ll go ahead and resolve this, but let me know if you ever see it again.

0reactions
jdisanticommented, Dec 6, 2022

I’m not able to repro this anymore in smithy-rs with Smithy 1.26.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Correct the classpath of your application so that it contains ...
I tried removing some dependencies but that didn't help. import javax.persistence.*; import java.util.Date; import javax.validation.constraints.
Read more >
Chapter 2. Validation step by step - Red Hat on GitHub
In this section we show how to annotate an object model with these annotations. We have to differentiate between three different type of...
Read more >
How the JVM Locates, Loads, and Runs Libraries - Oracle Blogs
A better practice is to resolve the confusion at its root and figure out why there are multiple classes with the same name...
Read more >
24. Externalized Configuration - Spring
Spring Boot allows you to externalize your configuration so you can work with the same application code in different environments. You can use...
Read more >
Upgrading your build from Gradle 6.x to the latest
Alternatively, you could run gradle help --warning-mode=all to see the ... projects imported into Eclipse include the compile and runtime classpath for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found