Skip to content

No class names generated? #59

Open

Description

@RichardB01

##Description
When running the tool, the output code is incomplete, missing the class name.

  • Type: Bug

Bug

debian 10 64bit.
node version v10.21.0
version 0.1.0

.puml file:

@startuml

class Test

@enduml

puml2code command:
puml2code -i class_diagram.puml -o ./src/ -l cpp

puml2code output

Handlebars: Access has been denied to resolve the property "getFullName" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getExtends" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getPrivateFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getFields" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getConstructorArgs" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "getMethods" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

C++ code output 'Test.h':

/**
 * \file .h
 */

#ifndef _h
#define _h




class  {
  private:
  protected:
  public:

  public:
    ()
    {
      // @todo
    }
    // Public methods


  // Protected methods
  protected:

  // Private methods
  private:
}

#endif // _h

Activity

  1. jupe commented on Jul 28, 2020

    @jupe
    Owner

    Looks a clear bug. probably there is no proper handling when class definition is empy. What happens if you add more content to class? Does example work for you? I’m on holiday so fix is coming a bit later. PR is also welcome :)

  2. RichardB01 commented on Jul 28, 2020

    @RichardB01
    Author

    Ok thanks!

    If i try the example this is the output (it doesn't save to a file):

    Handlebars: Access has been denied to resolve the property "getFullName" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    Handlebars: Access has been denied to resolve the property "getExtends" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    Handlebars: Access has been denied to resolve the property "getPrivateFields" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    Handlebars: Access has been denied to resolve the property "getFields" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    Handlebars: Access has been denied to resolve the property "getConstructorArgs" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    Handlebars: Access has been denied to resolve the property "getMethods" because it is not an "own property" of its parent.
    You can add a runtime option to disable the check or this warning:
    See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
    
    /**
     * \file .h
     */
    
    #ifndef _h
    #define _h
    
    
    
    
    class  {
      private:
      protected:
      public:
    
      public:
        ()
        {
          // @todo
        }
        // Public methods
    
    
      // Protected methods
      protected:
    
      // Private methods
      private:
    }
    
    #endif // _h
    
    /**
     * \file .h
     */
    
    #ifndef _h
    #define _h
    
    
    
    
    class  {
      private:
      protected:
      public:
    
      public:
        ()
        {
          // @todo
        }
        // Public methods
    
    
      // Protected methods
      protected:
    
      // Private methods
      private:
    }
    
    #endif // _h
    
    /**
     * \file .h
     */
    
    #ifndef _h
    #define _h
    
    
    
    
    class  {
      private:
      protected:
      public:
    
      public:
        ()
        {
          // @todo
        }
        // Public methods
    
    
      // Protected methods
      protected:
    
      // Private methods
      private:
    }
    
    #endif // _h
    
    
  3. RichardB01 commented on Jul 28, 2020

    @RichardB01
    Author

    Just tested on my macbook, it doesn't work here their, exactly the same results, device details:

    Catalina 10.15.6
    Node version: 12.18.1

  4. RichardB01 commented on Jul 28, 2020

    @RichardB01
    Author

    Works on my PC 64bit win10
    Node v10.15.2

  5. jupe commented on Jul 29, 2020

    @jupe
    Owner

    so it didn’t work with node v12 but works with node v10 ? I don’t think that OS causes this..

  6. jupe commented on Jul 29, 2020

    @jupe
    Owner

    note that CI doesn’t validate currently node v12.. have to add it there as well

  7. jupe commented on Jul 30, 2020

    @jupe
    Owner

    I was not able to reproduce this issue yet with any node version. I added also node v12 to CI and same puml file you mention without luck. output looks correct to me: https://app.circleci.com/pipelines/github/jupe/puml2code/255/workflows/8573a73d-1c03-41a3-86ea-38bc13f2d4ea/jobs/778

    /**
     * \file Test.h
     */
    
    #ifndef Test_h
    #define Test_h
    
    
    
    
    class Test {
      private:
      protected:
      public:
    
      public:
        Test()
        {
          // @todo
        }
        // Public methods
    
    
      // Protected methods
      protected:
    
      // Private methods
      private:
    }
    
    #endif // Test_h
    

    Tried also with Mac. CI are running with linux. How did you install tool ? via npm or git clone.. ?

  8. RichardB01 commented on Jul 30, 2020

    @RichardB01
    Author

    I was not able to reproduce this issue yet with any node version. I added also node v12 to CI and same puml file you mention without luck. output looks correct to me: https://app.circleci.com/pipelines/github/jupe/puml2code/255/workflows/8573a73d-1c03-41a3-86ea-38bc13f2d4ea/jobs/778

    /**
     * \file Test.h
     */
    
    #ifndef Test_h
    #define Test_h
    
    
    
    
    class Test {
      private:
      protected:
      public:
    
      public:
        Test()
        {
          // @todo
        }
        // Public methods
    
    
      // Protected methods
      protected:
    
      // Private methods
      private:
    }
    
    #endif // Test_h
    

    Tried also with Mac. CI are running with linux. How did you install tool ? via npm or git clone.. ?

    I installed puml2code by git cloning the repository and then npm -i -g within the directory

  9. RichardB01 commented on Jul 31, 2020

    @RichardB01
    Author

    I have setup the puml2code project on my macbook, it runs correctly when ran in the development environment (VS Code). It must be something to do with the installation commands.

    edit 1:
    It looks like this is a security feature of Handlebars see: https://stackoverflow.com/a/61346190/1322654

    edit 2:
    In the package.json file, Handlebars is set to ^4.1.1 which means the latest handlebars is being installed, this is probably why it installs 4.6.0/latest handlebars instead of 4.1.1

    edit 3:
    I think that at (https://github.com/jupe/puml2code/blob/master/src/index.js#L144) this line, you need to supply the template with template({element: element}) to fix the security error but i'm not certain, this change will mean you have to add prefixes to the handlebar templates

  10. jupe commented on May 9, 2021

    @jupe
    Owner

    @Bambofy thanks for investigation help. Unfortunately I haven’t had time to test this more but thanks for you, I’ve now idea’s what to try next..

  11. cTatu commented on Apr 6, 2022

    @cTatu

    For me it gives the exact same error "Handlebars: Access has been denied" on 2 separate environments.
    The first one:

    OS: Windows 11
    Node: v16.13.2
    NPM: v8.1.2
    puml2code: v0.7.0
    

    The second one:

    OS: Ubuntu 20
    Node: v14.18.3
    NPM: v8.3.2
    puml2code: v0.7.0
    

    I also tried installing it with npm -g install puml2code and by cloning the repo but the result is exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions