HomeMesosphereNo notifications. 4 unresolved issues.

Added strict mode to RamlTypeGenerator to be able to throw an validation error if unknown properties submitted via ValidationResource
Needs RevisionAll Users

Authored by unterstein on Apr 18 2017, 5:23 PM.

Details

Summary

If unknown properties are submitted in a json posted to marathon, this should be validated at validation endpoint.

Depends on D698

Test Plan

sbt test

Diff Detail

Repository
rMARATHON marathon
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 2210
Build 4174: Marathon (deprecated)Velocity Results
Build 4173: arc lint + arc unit
unterstein created this revision.Apr 18 2017, 5:23 PM
unterstein updated this revision to Diff 2715.Apr 18 2017, 5:39 PM
  • removed scalastyle:off
  • fixed typo and test fixture
unterstein edited the test plan for this revision. (Show Details)Apr 18 2017, 5:39 PM
unterstein edited the test plan for this revision. (Show Details)
unterstein edited the summary of this revision. (Show Details)
unterstein edited the test plan for this revision. (Show Details)
jenkins requested changes to this revision.Apr 18 2017, 5:41 PM
This revision now requires changes to proceed.Apr 18 2017, 5:41 PM
unterstein updated this revision to Diff 2716.Apr 18 2017, 5:48 PM
  • added failing test to also test embedded unknown properties
unterstein updated this revision to Diff 2717.Apr 18 2017, 5:53 PM
  • added additional test for unknown properties in pods
jenkins requested changes to this revision.Apr 18 2017, 5:57 PM
This revision now requires changes to proceed.Apr 18 2017, 5:57 PM
jasongilanfarr requested changes to this revision.Apr 18 2017, 7:23 PM

I'm not sure why we would want non-strict mode... so with that in mind, if we only use strict, can we remove the stack/dependency too?

changelog.md
65

I feel like this should be a separate change item.

project/RamlTypeGenerator.scala
14

I didn't link the comments from the previous review. Why is the valuable information?

488

We should _just_ have strict mode no?!

492

Why do we want non-strict mode ever?

unterstein added inline comments.
project/RamlTypeGenerator.scala
14

It took me around 30 minutes to figure out that I need to do sbt reload and I wanted to prevent others from this loss of time. If this is not needed I can remove it.

On current master you need more then reload, right? There were some kind of caching added. What do I need to do correctly? I did clean, but probably this is too much, right?

492

It`s a breaking change. I can not make the decision to change the default. If we want to have it, @meichstedt or someone from the product team need to make this decision. I asked @meichstedt to discuss it.

A plan could be to announce this with 1.5 and the validation endpoint and then remove the non-strict way.

project/RamlTypeGenerator.scala
14

I guess I just thought this was totally obvious since its part of the project itself and all of those files need a reload. I don't believe the caching needs to change, but we could record the last modified time of this file to see if the cache is invalid anyways.

492

I thought the JIRA for this already said that our current behavior is actually a bug and I feel like I recently saw an issue come up where the user was confused. I don't think its actually breaking since we don't preserve the information anyways... @jdef ?

If anything, I'd love to see "allowDeprecated" as an option so we can warn in the validation endpoint.

jdef added inline comments.Apr 18 2017, 8:38 PM
changelog.md
65

the summary and title of this changeset mentioned the new validation endpoint. This comment mentions /v2/apps. Confusing at best, likely something is wrong somewhere

project/RamlTypeGenerator.scala
14

FWIW I've never had to sbt reload to pick up changes to this file

487

please provide some sample scala output generated by these changes

492

(a) it's potentially "breaking" if you try to install a universe package that has a marathon.json template w/ bogus fields. or if Alice or Dan has some custom tooling/scripting that's been getting away with submitting bad JSON to marathon -- that tooling will now break if we always enforce strict mode. I think that I can live with that as long as we thoroughly call this out as a potentially breaking change in the changelog. since marathon 1.5 should only ever emit valid JSON fields .. I think I'm ok with this kind of breaking change.

the only edge case that I can think of is that Alice or Dan queries a groups endpoint, and tries to feed the json back into Marathon. that's going to break w/ strict field validation because the groups endpoint potentially embeds lots of fields that are really part of, for example, an AppInfo type, and not App. should we be worried about this? maybe... or maybe not: users that want to do this are already faced with the prospect that marathon 1.4 and prior output JSON that can't be fed back into Marathon without cleanup because in 1.4 and prior Marathon actually populates deprecated fields upon serialization -- a practice that has already stopped with Marathon 1.5

(b) yes, i'd also rather see a flag to toggle on/off support for deprecated fields. in a separate PR, probably tracked by a separate JIRA

project/RamlTypeGenerator.scala
14

Well that's some black magic. all of *.sbt and project/*.scala have to be reloaded to get their changes picked up.

492

+1 on (b) - JIRA and PR separately.