You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by moriarty <gi...@git.apache.org> on 2016/10/25 12:13:59 UTC

[GitHub] avro pull request #147: AVRO-1941: C++: adds __SCHEMA__ in generated code

GitHub user moriarty opened a pull request:

    https://github.com/apache/avro/pull/147

    AVRO-1941: C++: adds __SCHEMA__ in generated code

    This adds an ```avro::ValidSchema __SCHEMA__``` to each generated struct.
    
    ```__SCHEMA__``` is initialized in constructor using ```avro::compileJsonSchemaFromString```.
    
    This is a proposal for convenient way to access a schema similar to the generated Java classes, which have:
    ```
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(...);
    public static org.apache.avro.Schema getClassSchema() {return SCHEMA$; }
    ```
    
    This is a proposal and doesn't add ```__SCHEMA__``` to enums, which the Java generated classes do have. I couldn't think of a c++ way to do that, and am still waiting on feedback for [AVRO-1940](https://issues.apache.org/jira/browse/AVRO-1940) or GH apache/avro#146

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/moriarty/avro avro-1941/cpp-include-schema-in-generated-structs/dev

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/147.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #147
    
----
commit 945b60106b1f775afceb5006575c52e9af893f97
Author: Alexander Moriarty <al...@tba.nl>
Date:   2016-10-25T11:50:49Z

    AVRO-1941: C++: adds __SCHEMA__ in generated code
    
    This adds an avro::ValidSchema __SCHEMA__ to each generated struct.
    
    __SCHEMA__ is initialized in constructor using avro::compileJsonSchemaFromString.
    
    This is a proposal for convenient way to access a schema similar to the generated Java classes, which have:
    ```
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(...);
    public static org.apache.avro.Schema getClassSchema() {return SCHEMA$; }
    ```
    
    This is a proposal and doesn't add __SCHEMA__ to enums, which the Java generated classes do have. I couldn't think of a c++ way to do that, and am still waiting on feedback for AVRO-1940 or GH apache/avro#146

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] avro pull request #147: AVRO-1941: C++: adds __SCHEMA__ in generated code

Posted by moriarty <gi...@git.apache.org>.
Github user moriarty closed the pull request at:

    https://github.com/apache/avro/pull/147


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] avro pull request #147: AVRO-1941: C++: adds __SCHEMA__ in generated code

Posted by moriarty <gi...@git.apache.org>.
Github user moriarty closed the pull request at:

    https://github.com/apache/avro/pull/147


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] avro pull request #147: AVRO-1941: C++: adds __SCHEMA__ in generated code

Posted by moriarty <gi...@git.apache.org>.
GitHub user moriarty reopened a pull request:

    https://github.com/apache/avro/pull/147

    AVRO-1941: C++: adds __SCHEMA__ in generated code

    This adds an `avro::ValidSchema __SCHEMA__` to each generated struct.
    
    `__SCHEMA__` is initialized in constructor using `avro::compileJsonSchemaFromString`.
    
    This is a proposal for convenient way to access a schema similar to the generated Java classes, which have:
    
    ```
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(...);
    public static org.apache.avro.Schema getClassSchema() {return SCHEMA$; }
    ```
    
    This is a proposal and doesn't add `__SCHEMA__` to enums, which the Java generated classes do have. I couldn't think of a c++ way to do that, and am still waiting on feedback for [AVRO-1940](https://issues.apache.org/jira/browse/AVRO-1940) or GH apache/avro#146


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/moriarty/avro avro-1941/cpp-include-schema-in-generated-structs/dev

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/147.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #147
    
----
commit 945b60106b1f775afceb5006575c52e9af893f97
Author: Alexander Moriarty <al...@tba.nl>
Date:   2016-10-25T11:50:49Z

    AVRO-1941: C++: adds __SCHEMA__ in generated code
    
    This adds an avro::ValidSchema __SCHEMA__ to each generated struct.
    
    __SCHEMA__ is initialized in constructor using avro::compileJsonSchemaFromString.
    
    This is a proposal for convenient way to access a schema similar to the generated Java classes, which have:
    ```
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(...);
    public static org.apache.avro.Schema getClassSchema() {return SCHEMA$; }
    ```
    
    This is a proposal and doesn't add __SCHEMA__ to enums, which the Java generated classes do have. I couldn't think of a c++ way to do that, and am still waiting on feedback for AVRO-1940 or GH apache/avro#146

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---