1. A code generation system comprising: a memory configured to store application environment specifications and communication protocol specifications, an application environment specification specifying a target application environment of an application, and a communication protocol specification specifying a communication protocol; a processor system to implement a code generation application that is configured to: receive a schema, the schema describing a resource in a smart-home environment, the schema including a description of the resource, one or more traits of the resource, and one or more interfaces of the resource, each of the one or more interfaces of the resource providing access to functionality of the resource, and the functionality comprising at least one of the one or more traits of the resource, and each of the one or more interfaces providing semantic meaning to operation of the functionality of the one or more traits of the resource; translate the received schema into a target-specific data model, the translation based on the application environment specification of the target application environment and the communication protocol specification that is associated with the communication protocol used for communication with the resource in the smart-home environment, the target-specific data model comprising an Application Programming Interface (API) specific to the target application environment and the communication protocol; extract elements of the received schema that are usable by the application that communicates with the resource using an interface of the resource; using the extracted elements, generate a common object model in which the extracted elements are presented for an application developer, independent of the communication protocol; and provide the target-specific data model to the application that interacts with the interface of the resource by using the API of the target-specific data model to perform operations that are specific to communicating with the interface of the resource in the target application environment and using the communication protocol supported by the resource for communication in the smart-home environment.