# Is there a computer science theory behind automatic source code generation

The OpenAPI specification aims at standardizing the representation of REST based systems in json and yaml formats. A short version of the petstore is below:

{
"swagger": "2.0",
"info": {},
"host": "petstore.swagger.io",
"basePath": "/v2",
"tags": [],
"schemes": [
"http"
],
"paths": {},
"securityDefinitions": {},
"definitions": {},
"externalDocs": {
"description": "Find out more about Swagger",
"url": "http://swagger.io"
}
}


Based on this document, client and server stubs can be generated in different programming languages/frameworks using the OpenAPI codegen project. Is there a computer science theory behind this ? To be more precise, I want to specifically know if there are theoretical concepts behind taking an input, (in this case a json/yaml document) and getting a source code representation in one or more programming languages that represents the initial input ?

• @DavidRicherby +1 for the wikipedia reference. It included the information I was looking for. I understand now that generative programming , (which falls under automatic programming), deals with automatic code generation. I also found some academic papers that give more insights into the theory and related research :) I can accept your answer if you move it to the appropriate place. – SyCode Jun 13 '18 at 16:38
• OK. We generally discourage answers that are just a link to some other resource so, if somebody posts a proper answer that isn't just a link, please unaccept mine and give them the credit that I don't deserve. :-) – David Richerby Jun 13 '18 at 16:49