LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

If no includeAll, dont include all #3

Closed dquenne closed 4 years ago

dquenne commented 5 years ago

I'm actually not sure which is intended behavior, but I think it's the latter.

- allDefs.filter(def => !diagram.includeAll || diagram.includeAll === def.file)
liveandrew commented 5 years ago

think this was the desired behavior. perhaps we could rename includeAll to includeOnly?

dquenne commented 5 years ago

Is there an easy way for me to only include, e.g., 4 modules from one file and nothing else? Seems like in the current state, I'd need to explicitly exclude every file, and then include those 4 modules. Seems painful to maintain.

edit:

This isn't a terrible work-around:

diagram combo {
  /includeAll
    none.reslang // this file doesn't actually exist
  /include
    CombinationRule
    RuleClause
    RuleOperator
    RuleItem
    Segment
  /group "Combination Rule"
    CombinationRule
    RuleClause
    RuleOperator
    RuleItem
}
liveandrew commented 5 years ago

yeah it's an interesting one - when you say "4 modules" do you mean 4 resource definitions?

are they currently living in the same file? if so, you can also inlcudeAll on the file and then /exclude any you don't want.

otherwise, i'm very much open to suggestions. the current structure is just my first pass on getting the expressiveness for the diagrams i needed at the time.

dquenne commented 5 years ago

when you say "4 modules" do you mean 4 resource definitions?

Yeah, sorry, I just mean 4 resources. Basically, I want to include 4 specific resources from a file but no others, so I'd rather do this as a "whitelist" for those 4, than a "blacklist" for every other resource/struct in the file. I guess this is more of a feature request than a bug fix, now that I understand the intention of includeAll a bit better.

are they currently living in the same file?

They are, but so are a lot of other things. Might be that an alternative solution to my problem is just split these into two files - might be better for organization anyway. I'll try this strategy out.

liveandrew commented 5 years ago

I want to include 4 specific resources from a file but no others

can't you just do? /include A B C D

oh wait, i see you've already answered that above with none.reslang.

we could add an /includeNone command?