Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Isomorphic
    replied
    We'll review the Object properties that claim "W". For now, yes, just ignore this flag.

    SectionStack.getSections(): we'll add a new API getSectionNames() and deprecate getSections(), so you should be able to have your script ignore the wrong-typed getter since it will be deprecated.

    We don't see an attribute in the code or in referencesDocs.xml for listGrid.dateTimeFormatter with a capital "T", neither for DetailViewer. Possibly still running against an older version?

    Leave a comment:


  • kylemwhite
    replied
    Latest from SNAPSHOT_v11.1d_2017-05-09 is committed. I don't think much has changed. In order to improve communications about issues found in the referenceDocs.xml file, I am now generating a progress report which can be found here: Progress.md. Note that I've implemented a lot of 'rules' that I have inferred from the docs, the forum and some common sense. If my understanding is flawed, please let me know and I'll adjust the rules accordingly.

    Leave a comment:


  • kylemwhite
    replied
    New version (from 5/6/17 snapshot). I've added more validations and formatted for easy viewing. The details can be found in the repository Errors.txt file. Not everything is necessarily an error but might need looking at.

    Metrics for build SNAPSHOT_v11.1d_2017-05-06
    Types: 229
    Classes: 309
    Objects: 67
    Methods: 3555
    Methods with bad flags: 3
    Classes without inherits from: 202
    string values with quotes: 216
    string values without quotes: 657
    string values with period: 130
    array of: 1
    Array of: 225
    Array[] of: 10
    array[] of: 0
    Just array or Array: 10
    String types without baseType: 83
    Method params with missing name: 15
    Method params with bad name: 1
    Method params missing type: 7
    Methods with required parameters after optional parameters: 7
    Setter Methods with paramter type that does not match the attribute type: 88
    Non-optional params with the word 'Optional' in the description: 19
    Getter Methods with return type that does not match the attribute type: 42

    Leave a comment:


  • kylemwhite
    replied
    There's a attribute on ListGrid called dateTimeFormatter, however in the docs, the name is datetimeFormatter. This requires a special rule in the generator to fix the T in time. There's a similar attibute on DetailViewer but in that case, the name really is datetimeFormatter.

    Leave a comment:


  • kylemwhite
    replied
    SectionStack has an attribute called sections which is an Array of SectionStackSection Properties. It also has a getSections() method but the method returns a list of names. So, according to the docs, if an attribute has a getter, then you must use the getter. However in this case, the getter does not return the sections, it returns the names of the sections. So, should getSections() be renamed to getSectionNames()? Or should getSections() return an array of SectionStackSections? Or am I missing something else?

    I discovered this because the generator no longer generates properties for attributes that have a getter, the idea being to force use of the getter when it is available.

    Leave a comment:


  • kylemwhite
    replied
    The height attribute on Canvas is specified as Number or String, which makes sense. The setHeight(height: Number) method, however, specifies only number. I will add another validation to make sure that type in the setter method matches the type on the attribute.

    Leave a comment:


  • kylemwhite
    replied
    Ok, I will ignore the W on objects for now, effectively making them read-only. Will the same logic for other objects as well such as SectionStackSection, Hilite, EditNode, HeaderSpan etc.? And does it make sense for my validation process to check for any Objects with an attribute marked with the W flag?

    Leave a comment:


  • Isomorphic
    replied
    Interesting edge case. These are marked writable because they can be updated, via APIs on TabSet such as tabSet.setTabTitle(), and the generic setTabProperties(). But rather than marking them "W" we should leave off the W and just link to the setter on TabSet via the docs. We'll correct this, so your script shouldn't need any special logic here.

    Leave a comment:


  • kylemwhite
    replied
    I've run into a snag. On the Tab object, there are many attributes marked with the W flag and no setters. Since Tab is an object, it does not inherit from Class which means that it has no setProperty() method either. So, if the attribute is writable, doesn't have a setter and it belongs to an object that does not inherit from Class, what is the correct way to set the value?

    Leave a comment:


  • kylemwhite
    replied
    Yes, I'm trying to use the term 'attibute' to refer to the attributes on SC classes/object and properties to refer to JS/TS dot notation properties and method for functions including setters and getters. I think we're on the same page.

    Leave a comment:


  • Isomorphic
    replied
    By "properties" here we think you specifically mean accessing and assigning via dot notation (object.someProperty) without a method call. If so, then your second set of rules is correct.

    Leave a comment:


  • kylemwhite
    replied
    Oops, after re-reading about the flags, I think the rules are even simpler:
    • ALL properties are readonly because if the attribute is writeable, you must use the setter or setProperty().
    • If an attribute has a getter then don't generate the property at all (i.e. force use of getter).

    Leave a comment:


  • kylemwhite
    replied
    Understood. I am currently modifying the generator with these rules. Please verify that they make sense.
    • If an attribute is not marked with the W flag, make it readonly.
    • If an attribute has a getter and a setter, then don't generate the property at all (i.e. force use of getter and setter).
    • If an attribute is readonly (no W flag), and has a getter, then hide it (i.e force use of the getter).
    • If an attribute is writeable (has a W flag) and has a setter but no getter, then make it readonly (i.e. create the property for reading but enforce use of the setter for writing).

    Leave a comment:


  • Isomorphic
    replied
    filterButtonPrompt is indeed not writable after create(). It looks like it happens to work in some case you've found, but that's just luck, not a supported feature.

    But unfortunately, your code would still be wrong even if it were a writable property. See documentation for the IRW flags we referred you to earlier: if a property is writable after create(), you need to either call it's setter or call setProperty().

    Leave a comment:


  • kylemwhite
    replied
    I've adjusted the generator to create properties as readonly if there is no W flag. This is working and the TypeScript compiler won't let me assign to a readonly property, great. But, I now have an error in my program on this line:

    Code:
    grid.filterButtonPrompt = "Clear the filter"   // grid is a ListGrid
    The filterButtonPrompt property is now readonly (because it is not marked with the W flag) and there is no setFilterButtonPrompt() method. So, is the filterButtonPropmpt property just not supposed to be updateable or is it missing the W flag?

    The code works in JavaScript and in TypeScript if I do:
    Code:
    (grid as any).filterButtonPrompt = "Clear the filter"   // grid is a ListGrid
    So I suspect it's just missing the W flag. And, if that's the case, can you think of a way that the code generator could help find these errors?

    Leave a comment:

Working...
X