STATICALLY CHECKING INTER-PROPERTY CONSTRAINTS and Its Applications in Web Apis

Total Page:16

File Type:pdf, Size:1020Kb

STATICALLY CHECKING INTER-PROPERTY CONSTRAINTS and Its Applications in Web Apis Proefschrift ingediend met het oog op het behalen van een doctoraatsdiploma Dissertation submitted in fulfilment of the requirement for the degree of Doctor of Philosophy in Sciences STATICALLY CHECKING INTER-PROPERTY CONSTRAINTS and its Applications in Web APIs Nathalie Oostvogels Promotor: Prof. Dr. Wolfgang De Meuter Copromotor: Prof. Dr. Joeri De Koster Faculty of Science and Bio-Engineering Sciences Statically Checking Inter-property Constraints and its Applications in Web APIs Nathalie Oostvogels Dissertation submitted in fulfillment of the requirement for the degree of Doctor of Sciences April 2019 Jury: Prof. Dr. Wolfgang De Meuter, Vrije Universiteit Brussel (promotor) Prof. Dr. Joeri De Koster, Vrije Universiteit Brussel (copromotor) Prof. Dr. Ann Now´e,Vrije Universiteit Brussel (chair) Prof. Dr. Dominique Devriese, Vrije Universiteit Brussel (secretary) Prof. Dr. Ann Dooms, Vrije Universiteit Brussel Prof. Dr. Tobias Wrigstad, Uppsala University Dr. Manuel Serrano, INRIA Printed by: Crazy Copy Center Productions VUB Pleinlaan 2, 1050 Brussel Tel / fax : +32 2 629 33 44 [email protected] www.crazycopy.be ISBN 978 94 930 7921 2 NUR 989 Acknowledgements: The work in this dissertation has been funded by a PhD Fellowship of the Re- search Foundation - Flanders (FWO) and the SBO project Tearless by the Agency for Innovation and Entrepreneurship (VLAIO). Copyright: All rights reserved. No part of this publication may be produced in any form by print, photoprint, microfilm, electronic or any other means without permission from the author. c 2019 Nathalie Oostvogels Abstract Software applications do not stand on their own: their code often uses libraries to incorporate functionality to facilitate the development process (such as abstrac- tions and helper functions) or to integrate functionality from third parties. Li- braries offer their functionality via an Application Programming Interface (API), which is a contract between the library and the user. It defines which methods are provided, and imposes constraints on the data or fields that are exchanged. Constraints dictate the presence of fields, the type of fields, and the allowed values for fields. Constraints imposed on a singular field are clearly indicated in the documentation and well-supported in tooling and specification languages. Next to singular constraints, API documentation often describes relations between fields. For example, some fields may only be provided together, or the value of a field may impose constraints on other parts of the data. In this dissertation, we demonstrate the prevalence of such constraints in web APIs. We show that there is no structural support for these inter-property con- straints: they cannot be expressed by contemporary API specification languages such as OpenAPI. This lack of support extends to programming languages, whose type system can only express and validate single-property constraints, but not inter-property constraints. This dissertation presents a statically-typed program- ming language that fills this gap. Our programming language, TIPC, features a natural extension to inter- face definitions which allows enforcing presence constraints between properties. TIPC ensures that objects with inter-property constraints satisfy these constraints throughout the program. Furthermore, it enables programmers to refine interface types using its flow-sensitive type system. We present a formal specification of the syntax, operational semantics and type system of TIPC, along with soundness proofs. As a proof of concept, we use TIPC as a model to extend the TypeScript compiler with support for inter-property constraints. Finally, we extend the OpenAPI specification language with support for fully generalised inter-property constraints. This language serves as a proving ground for inter-property constraint aware tooling. Concretely, a first artefact presents an intercepting middleware that verifies constraints on both the caller side and the library side. A second artefact shows how interfaces enabled with inter-property constraints can be generated from an API specification. Both artefacts enable the automatic verification of inter-property constraints in applications, respectively at runtime and at compile-time. iii Samenvatting Softwareprogramma’s staan niet op zichzelf: ze integreren vaak functionaliteit van bestaande codebibliotheken. De functionaliteit die zulke bibliotheken aan- bieden, kan het ontwikkelingsproces bevorderen of functionaliteit van derde par- tijen beschikbaar stellen. Deze functionaliteit wordt beschikbaar gesteld via een API (een programmeerinterface), die een contract vormt tussen de codebibliotheek en de gebruiker. Dit contract beschrijft welke methodes aangeboden worden en welke vereisten er worden gelegd op de data of velden die worden uitgewisseld. Vereisten leggen restricties op de aanwezigheid van velden, op hun type en hun toegestane waardes. Vereisten op een enkel veld zijn goed aangeduid in de documentatie en zijn goed ondersteund door programmeerhulpmiddelen en specificatietalen. Naast vereisten op een enkel veld, legt de documentatie van API’s ook nog eisen op tussen velden. Sommige velden mogen bijvoorbeeld enkel samen voorkomen, of de waarde van een veld kan de vereisten op een ander veld be¨ınvloeden. In deze verhandeling tonen wij het voorkomen van zulke vereisten in de documentatie van web API’s. We tonen dat er geen structurele ondersteuning bestaat voor inter-veld vereis- ten: ze kunnen niet worden uitgedrukt in hedendaagse specificatietalen zoals OpenAPI. Ook programmeertalen bieden geen ondersteuning: hun typesystemen kunnen enkel vereisten over een enkel veld uitdrukken. Deze verhandeling presen- teert een statisch getypeerde programmeertaal die deze kloof dicht. Onze programmeertaal, TIPC, heeft een natuurlijke uitbreiding van interface definities die ervoor zorgt dat aanwezigheidsvereisten tussen velden kunnen wor- den opgelegd. TIPC garandeert dat objecten met inter-veld vereisten tijdens het hele programma aan deze eisen voldoen. Bovendien zorgt TIPC ervoor dat programmeurs de interface types specifieker kunnen maken doordat het typesys- teem rekening houdt met if-testen in het programmaverloop. We presenteren een formele specificatie van de syntaxis, operationele semantiek en het typesysteem van TIPC, samen met een bewijs van correctheid. We integreren het TIPC model in de TypeScript compiler, waardoor we een uitbreiding op TypeScript verkrijgen die inter-veld vereisten kan garanderen. Tenslotte breiden we de OpenAPI specificatietaal uit met ondersteuning voor algemene inter-veld vereisten. Deze taal dient als een basis om hulpprogramma’s met inter-veld constraints te testen. Een eerste artifact presenteert een middleware die nagaat of aan de vereisten wordt voldaan, zowel aan de kant van de gebruiker als de kant van de codebibliotheek. Een tweede artifact toont hoe interfaces met inter-veld vereisten gegenereerd kunnen worden uit API specificaties. Beide artifacten zorgen ervoor dat er automatisch wordt nagegaan of inter-veld vereisten worden voldaan, zowel tijdens het uitvoeren als vooraf. v Acknowledgments First of all, I would like to thank the two people who promote this work: Wolf and Joeri. Wolf, I want to sincerely thank you for giving me the opportunity to pursue a PhD. You let me take my time to figure out what the topic of this PhD was going to be, which shaped this PhD to what it is today. I would like to thank the members of the jury, Dominique Devriese, Ann Dooms, Ann Now´e,Manuel Serrano, and Tobias Wrigstad, for the interesting discussions, which resulted in new insights that definitely improved this dissertation. Next to the promotors and jury members, I would like to thank the extra proofreaders of my text: Quentin and Dries. I would like to thank the unique bunch of people whom I may call my col- leagues. There are a few (ex-)colleagues (going on friends) I want to thank in particular. For the most part of this PhD, I have had the privilege of working together with one of my bestest friends. Simon: it has been an honour to have you by my side to teach a few hundred 18-year olds the ins and outs of algorithms and data structures. A big thanks to het olijke (office-sharing) duo: Thierry and Janwillem. You guys were always up for PhD-related discussions which shaped and structured my thoughts and worries about inter-property constraints, as well as the (equally as important) non-PhD-related discussions. Jesse, thank you for your brutally honest view on things. Laure, your absence at SOFT (and the emptiness of your bowl of candy) is not going unnoticed. Lara, thanks for the talks about the little things in life, the sad things, the happy things, and the big things. One of Wolf’s selling points of a PhD is that it comes along with the chance of exploring the world, and he was certainly right. A big thanks (again) to my travel buddies throughout the years: chasing Oregon’s waterfalls with Thierry & Laure, finally going on “Romereis” with Laure & Janwillem (I can recommend them as tour guides!), and lunching at the foot of a Canadian glacier with Janwillem. Many friends and family have supported me during the past few years. I want to truly thank you all for all the diversions in the form of board gaming nights, food and/or Sunday afternoon teas. It is impossible (and too dangerous) to list everyone, but special shoutout to the OG: Killian, Koen, and Murielle! Before this acknowledgment section ends and the actual dissertation starts, I want to thank the most important people in my life. In het dankwoord
Recommended publications
  • Perhaps Not the Answer You Were Expecting but You Asked for It
    Perhaps Not The Answer You Were Expecting But You Asked For It (An Accidental Blook) Conor McBride October 23, 2019 2 Contents 1 Haskell Curiosities 7 1.1 What is () in Haskell, exactly? . 7 1.2 What does () mean in Haskell? . 8 1.3 Implement the function lines in Haskell . 9 1.4 Boolean Expression evaluation (subtle type error) . 9 1.5 Purely functional data structures for text editors . 10 1.6 What are some motivating examples for Cofree CoMonad in Haskell? . 12 1.7 Find indices of things in lists . 15 1.8 How do I extend this mergeWords function to any number of strings? . 15 1.9 Example of UndecidableInstances yielding nonterminating typecheck . 16 1.10 Why do 3 and x (which was assigned 3) have different inferred types in Haskell? . 17 1.11 Use case for rank-3 (or higher) polymorphism? . 18 1.12 Why don’t Haskell compilers facilitate deterministic memory management? . 19 1.13 How does ArrowLoop work? Also, mfix? . 19 1.14 What does ) mean in a type signature? . 20 1.15 Meaning of Double and Floating point? . 21 1.16 Haskell terminology: meaning of type vs. data type, are they synonyms? . 22 1.17 Can you formulate the Bubble sort as a monoid or semigroup? . 23 1.18 Is this a correctly implemented mergesort in Haskell? . 24 1.19 Haskell type system nuances (ambiguity) . 26 1.20 Understanding a case of Haskell Type Ambiguity . 27 1.21 Why does Haskell use ! instead of =?.......................... 27 1.22 Is it possible to make a type an instance of a class if its type parameters are in the wrong order? .
    [Show full text]
  • Haskell Communities and Activities Report
    Haskell Communities and Activities Report http://tinyurl.com/haskcar Thirty Fourth Edition — May 2018 Mihai Maruseac (ed.) Chris Allen Christopher Anand Moritz Angermann Francesco Ariis Heinrich Apfelmus Gershom Bazerman Doug Beardsley Jost Berthold Ingo Blechschmidt Sasa Bogicevic Emanuel Borsboom Jan Bracker Jeroen Bransen Joachim Breitner Rudy Braquehais Björn Buckwalter Erik de Castro Lopo Manuel M. T. Chakravarty Eitan Chatav Olaf Chitil Alberto Gómez Corona Nils Dallmeyer Tobias Dammers Kei Davis Dimitri DeFigueiredo Richard Eisenberg Maarten Faddegon Dennis Felsing Olle Fredriksson Phil Freeman Marc Fontaine PÁLI Gábor János Michał J. Gajda Ben Gamari Michael Georgoulopoulos Andrew Gill Mikhail Glushenkov Mark Grebe Gabor Greif Adam Gundry Jennifer Hackett Jurriaan Hage Martin Handley Bastiaan Heeren Sylvain Henry Joey Hess Kei Hibino Guillaume Hoffmann Graham Hutton Nicu Ionita Judah Jacobson Patrik Jansson Wanqiang Jiang Dzianis Kabanau Nikos Karagiannidis Anton Kholomiov Oleg Kiselyov Ivan Krišto Yasuaki Kudo Harendra Kumar Rob Leslie David Lettier Ben Lippmeier Andres Löh Rita Loogen Tim Matthews Simon Michael Andrey Mokhov Dino Morelli Damian Nadales Henrik Nilsson Wisnu Adi Nurcahyo Ulf Norell Ivan Perez Jens Petersen Sibi Prabakaran Bryan Richter Herbert Valerio Riedel Alexey Radkov Vaibhav Sagar Kareem Salah Michael Schröder Christian Höner zu Siederdissen Ben Sima Jeremy Singer Gideon Sireling Erik Sjöström Chris Smith Michael Snoyman David Sorokin Lennart Spitzner Yuriy Syrovetskiy Jonathan Thaler Henk-Jan van Tuyl Tillmann Vogt Michael Walker Li-yao Xia Kazu Yamamoto Yuji Yamamoto Brent Yorgey Christina Zeller Marco Zocca Preface This is the 34th edition of the Haskell Communities and Activities Report. This report has 148 entries, 5 more than in the previous edition.
    [Show full text]
  • Anders Åstrand: a Paragon of the Modern Musical Aesthetic
    University of Kentucky UKnowledge Theses and Dissertations--Music Music 2017 Anders Åstrand: A Paragon of the Modern Musical Aesthetic Matthew Geiger University of Kentucky, [email protected] Digital Object Identifier: https://doi.org/10.13023/ETD.2017.069 Right click to open a feedback form in a new tab to let us know how this document benefits ou.y Recommended Citation Geiger, Matthew, "Anders Åstrand: A Paragon of the Modern Musical Aesthetic" (2017). Theses and Dissertations--Music. 81. https://uknowledge.uky.edu/music_etds/81 This Doctoral Dissertation is brought to you for free and open access by the Music at UKnowledge. It has been accepted for inclusion in Theses and Dissertations--Music by an authorized administrator of UKnowledge. For more information, please contact [email protected]. STUDENT AGREEMENT: I represent that my thesis or dissertation and abstract are my original work. Proper attribution has been given to all outside sources. I understand that I am solely responsible for obtaining any needed copyright permissions. I have obtained needed written permission statement(s) from the owner(s) of each third-party copyrighted matter to be included in my work, allowing electronic distribution (if such use is not permitted by the fair use doctrine) which will be submitted to UKnowledge as Additional File. I hereby grant to The University of Kentucky and its agents the irrevocable, non-exclusive, and royalty-free license to archive and make accessible my work in whole or in part in all forms of media, now or hereafter known. I agree that the document mentioned above may be made available immediately for worldwide access unless an embargo applies.
    [Show full text]
  • A Bibliography of Publications in ACM SIGPLAN Notices, 2000–2009
    A Bibliography of Publications in ACM SIGPLAN Notices, 2000{2009 Nelson H. F. Beebe University of Utah Department of Mathematics, 110 LCB 155 S 1400 E RM 233 Salt Lake City, UT 84112-0090 USA Tel: +1 801 581 5254 FAX: +1 801 581 4148 E-mail: [email protected], [email protected], [email protected] (Internet) WWW URL: http://www.math.utah.edu/~beebe/ 09 November 2018 Version 1.82 Title word cross-reference '00 [2478, 33, 2480, 118, 119]. '01 [211]. 16-bit [855]. 2 [128, 1280]. 2000 [36, 327]. 2001 2 [1630]. 3 [1092, 1344, 1682, 1695, 248]. < [59, 58, 537, 274, 60]. 2003 [958, 1122]. 2008 [1230]. > [1230]. F [2067, 871]. TM [2060, 2005, 2164]. 21364 [674]. 21st [271]. [179, 175, 177]. ∆ [1505]. Γ [1615]. k [2088]. 28th [2482, 54]. λ [877, 960]. m [722]. N [1510, 2293, 522]. Π [1924, 2434]. Π0 [1630]. T [1364]. 6 [1715]. 64 [233, 364, 204]. -calculus [722, 960]. -complete [1630]. -pin '99 [16, 17]. [1344]. -queen [522]. -STL [27]. -synchronous [1510]. -valued [248]. -way = [534]. [2293]. abandoned [1032]. ABCD [90]. abduction .NET [1236, 2119, 1204, 865, 285, 973, 1348]. [2193]. Abstract [1190, 18, 985, 370, 926, 2292, 2362, 2365, /garbage [1919]. 1 2 2363, 2442, 499, 2366, 2367, 2295, 2358, 2075, 1108, 1402, 637, 893, 1281, 2048, 673, 770, 2443, 19, 1591, 500, 984, 2440, 2359, 408, 744, 839, 921, 2334, 2134, 340, 1077, 1572, 373]. 1582, 1946, 2297, 2360, 1826, 2446, 2400, 1615, adaptivity [1971]. Adding 253, 2441, 2199, 1192, 2364, 1211, 827, 1958, [1474, 1864, 1000, 2430, 1466].
    [Show full text]
  • Hermano José Marques Cintra.Pdf
    PONTIFÍCIA UNIVERSIDADE CATÓLICA DE SÃO PAULO PROGRAMA DE PÓS-GRADUAÇÃO EM TECNOLOGIAS DA INTELIGÊNCIA E DESIGN DIGITAL HERMANO JOSÉ MARQUES CINTRA A NOVA POTÊNCIA DA COOPERAÇÃO: efeitos da interatividade digital na ação coletiva empreendedora São Paulo - SP 2016 HERMANO JOSÉ MARQUES CINTRA A NOVA POTÊNCIA DA COOPERAÇÃO: efeitos da interatividade digital na ação coletiva empreendedora Tese apresentada à Banca Examinadora da Pontifícia Universidade Católica de São Paulo, exigência parcial para obtenção do título de Doutor em Tecnologias da Inteligência e Design Digital. Área de concentração: processos cognitivos e ambientes digitais Orientador: Profa. Dra. Maria Lucia Santaella Braga. São Paulo – SP 2016 ERRATA CINTRA, H J M. A Nova Potência da Cooperação: efeitos da interatividade digital na ação coletiva empreendedora. (Tese de Doutorado) Pontifícia Universidade Católica de São Paulo - Programa de Tecnologias da Inteligência e Design Digital, 2016. Folha (página) Linha Onde se lê: Leia-se: 19 (s/n) 4 <http://www.hcintra.com.br/linksdoutorado> <http://www.hcintra.com/linksdoutorado> 385 (355) 4 <http://www.hcintra.com.br/biBliodoutorado> <http://www.hcintra.com/biBliodoutorado> (Os endereços não possuem a terminação “.br”) Autorização de Publicação Autorizo a reprodução total ou parcial desta tese por processos de fotocópia ou eletrônicos para fins acadêmicos, científicos e educacionais, desde que citada a fonte. São Paulo, 28 de junho de 2016 Convite ao diáloGo O trabalho aqui apresentado procura entender a cooperação em ambiente digitais, portanto, não poderiam faltar meus localizadores digitais e meu convite à discussão dos temas abordados: Email: hcintra (em) hotmail.com Skype: hermano (ponto) cintra Site: www.hcintra.com Folha de Assinaturas da Banca Examinadora Profa.
    [Show full text]