WO2022230191A1 - Web api definition information generation device, web api definition information generation method, and program - Google Patents

Web api definition information generation device, web api definition information generation method, and program Download PDF

Info

Publication number
WO2022230191A1
WO2022230191A1 PCT/JP2021/017249 JP2021017249W WO2022230191A1 WO 2022230191 A1 WO2022230191 A1 WO 2022230191A1 JP 2021017249 W JP2021017249 W JP 2021017249W WO 2022230191 A1 WO2022230191 A1 WO 2022230191A1
Authority
WO
WIPO (PCT)
Prior art keywords
webapi
definition information
source code
node
parent
Prior art date
Application number
PCT/JP2021/017249
Other languages
French (fr)
Japanese (ja)
Inventor
卓弥 岩塚
Original Assignee
日本電信電話株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to PCT/JP2021/017249 priority Critical patent/WO2022230191A1/en
Publication of WO2022230191A1 publication Critical patent/WO2022230191A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/75Structural analysis for program understanding

Definitions

  • the present invention relates to a WebAPI definition information generation device, a WebAPI definition information generation method, and a program.
  • the web application executes processing according to the content of the requested HTTP request and returns an HTTP response.
  • Web API information indicating what kind of HTTP requests a Web application accepts is necessary when testing a Web application or creating a client application that uses the Web application.
  • one web application has zero or more web APIs, and each web API requires definition information about the path of the URL that waits for requests, the HTTP method that is accepted, and the request parameters.
  • web API definition information be provided as a document written in a fixed format so that it can be processed mechanically.
  • FIG. 1 when the WebAPI definition information is described in YAML format based on the OpenAPI specification, which is a specification for describing the WebAPI definition information, the WebAPI definition information can be mechanically processed. Easy.
  • Non-Patent Document 1 there is a technique for extracting WebAPI definition information from a Web application document written in HTML for the purpose of being read by humans (Non-Patent Document 1). According to this technique, it is possible to discover the path and HTTP method, which are the elements of the WebAPI definition information, from within the HTML document. Further, by using the structure of the DOM tree constructed from the document to estimate the correspondence between each element and linking each element, it is possible to automatically obtain WebAPI definition information. For example, even if WebAPI definition information with a path of "user/ ⁇ id ⁇ " and an HTTP method of "get” is described in any of the three patterns shown in (1) to (3) in FIG. , each element can be associated from the structure of the DOM tree and output as one piece of WebAPI definition information.
  • the present invention has been made in view of the above points, and an object of the present invention is to enable automatic generation of WebAPI definition information without depending on Web application documents.
  • the WebAPI definition information generation device includes an analysis unit that generates information that holds the parent-child relationship and the adjacency relationship of each line in the source code of the Web application, based on the indentation width of each line in the source code of the Web application. and a generation unit that generates definition information of the WebAPI by combining WebAPI components included in the source code based on the parent-child relationship and the adjacency relationship.
  • FIG. 3 is a diagram showing an example of WebAPI definition information described in YAML format
  • FIG. 4 is a diagram showing an example of WebAPI definition information in an HTML document
  • 1 is a diagram showing a hardware configuration example of a WebAPI definition information generating device 10 according to an embodiment of the present invention
  • FIG. 1 is a diagram showing a functional configuration example of a WebAPI definition information generating device 10 according to an embodiment of the present invention
  • FIG. FIG. 4 is a diagram for explaining indentation
  • 4 is a flowchart for explaining an example of a processing procedure executed by a source code structure analysis unit 11
  • FIG. 4 is a diagram showing an example of program structure information
  • FIG. 4 is a diagram showing an example of a path definition in a source code
  • FIG. 10 is a diagram showing an example of definition on a source code of WebAPI definition information elements of a path and an HTTP method; 4 is a flowchart for explaining an outline of a processing procedure executed by a WebAPI definition information generation unit 12;
  • FIG. 11 is a flowchart for explaining a processing procedure for adding a WebAPI definition information element to a node of program structure information;
  • FIG. 10 is a diagram for explaining an example of a processing procedure of path list generation processing;
  • FIG. 11 is a flowchart for explaining an example of a processing procedure for generating a list of WebAPI definition information;
  • a WebAPI definition information generation device that estimates the relationship between elements of WebAPI definition information searched from the source code of a Web application, combines the elements, and outputs a list of WebAPI definition information. 10 is disclosed.
  • indentation of the source code is used to analyze the structure of the source code in order to estimate the relationship between the elements of the WebAPI definition information.
  • FIG. 3 is a diagram showing a hardware configuration example of the WebAPI definition information generation device 10 according to the embodiment of the present invention.
  • the WebAPI definition information generation device 10 of FIG. have.
  • a program that implements processing in the WebAPI definition information generation device 10 is provided by a recording medium 101 such as a CD-ROM.
  • a recording medium 101 such as a CD-ROM.
  • the program is installed from the recording medium 101 to the auxiliary storage device 102 via the drive device 100 .
  • the program does not necessarily need to be installed from the recording medium 101, and may be downloaded from another computer via the network.
  • the auxiliary storage device 102 stores installed programs, as well as necessary files and data.
  • the memory device 103 reads and stores the program from the auxiliary storage device 102 when a program activation instruction is received.
  • the CPU 104 implements functions related to the WebAPI definition information generation device 10 according to programs stored in the memory device 103 .
  • the interface device 105 is used as an interface for connecting to a network.
  • a display device 106 displays a program-based GUI (Graphical User Interface) or the like.
  • the input device 107 is composed of a keyboard, a mouse, etc., and is used to input various operational instructions.
  • FIG. 4 is a diagram showing a functional configuration example of the WebAPI definition information generation device 10 according to the embodiment of the present invention.
  • the WebAPI definition information generation device 10 has a source code structure analysis unit 11 and a WebAPI definition information generation unit 12 . Each of these units is realized by processing that one or more programs installed in the WebAPI definition information generation device 10 cause the CPU 104 to execute.
  • the source code structure analysis unit 11 derives the structure of the source code (generates information indicating the structure of the source code) based on the indentation of the source code of the Web application (hereinafter simply referred to as "source code"). )do.
  • the WebAPI definition information generation unit 12 receives as inputs the components of the WebAPI definition information (WebAPI definition information elements) searched (extracted) from the source code and the structural information of the source code, estimates the relationship between the elements, and estimates the result. The elements are combined based on to generate the WebAPI definition information.
  • WebAPI definition information elements WebAPI definition information elements
  • the WebAPI definition information element search device 20 executes the search (extraction) of the WebAPI definition information element from the source code.
  • the WebAPI definition information generating device 10 may also perform such a search.
  • the search for the WebAPI definition information element from the source code can be realized using known techniques such as character string search using regular expressions, for example.
  • the programming language syntax has a recursive structure that has another sentence as an element that constitutes another sentence.
  • a common practice in formatting source code is to insert a line break at the end of each sentence.
  • more white spaces than the certain sentence are inserted at the beginning of the line of the other sentence. Indenting with white space in this way is called “indenting”. Also, the number of consecutive white spaces at the beginning of a line is called “indentation width”.
  • outer_block includes inner_block_1 and inner_block_2 as components.
  • each component is shaped so that it is easy to visually determine that it is a component of outer_block.
  • the source code structure analysis unit 11 analyzes how the source code is indented (the manner of indentation of each line in the source code), thereby analyzing the hierarchy of sentences without depending on the syntax defined for each programming language. Analyze structure.
  • the source code structure analysis unit 11 outputs the following program structure information for each file (file in which source code is recorded) as an analysis result.
  • the definitions below are based on the BNF (Backus-Naur form) notation.
  • An index which is an element of an ordered node, is a value that uniquely identifies each node in a group of nodes having the same parent node, and is a natural number that indicates the order of appearance in the source code. Also, the ordered nodes of the elements of the node are the child nodes of the node.
  • a tree structure (recursive structure) is represented by a node including ordered nodes, which are child nodes, as elements.
  • FIG. 6 is a flowchart for explaining an example of a processing procedure executed by the source code structure analysis unit 11.
  • the source code structure analysis unit 11 executes loop processing L1 for each file included in a list of source code files of a Web application.
  • One file to be processed in the loop processing L1 is hereinafter referred to as a "target file”.
  • step S101 the source code structure analysis unit 11 generates a root node without ordered nodes. Subsequently, the source code structure analysis unit 11 creates an empty stack (S102). This stack can store pairs of indent widths and references to nodes as elements.
  • the source code structure analysis unit 11 opens the target file (S103). Subsequently, the source code structure analysis unit 11 executes loop processing L2 including steps S104 to S112 for each line of the target file. Loop processing L2 is executed for all lines of the target file.
  • step S104 the source code structure analysis unit 11 reads the first line (hereinafter referred to as "target line") among the unprocessed lines in the target file. Subsequently, the source code structure analysis unit 11 determines whether the target line is a blank line (S105). If the target line is a blank line (Yes in S105), the source code structure analysis unit 11 does not execute step S106 and subsequent steps for the target line.
  • target line the first line
  • S105 the source code structure analysis unit 11
  • the source code structure analysis unit 11 acquires the indentation width of the target line (S106). Next, the source code structure analysis unit 11 compares the indentation width of the target line with the indentation width of the element at the top of the stack, and if the two match or if the indentation width of the target line is smaller, The top element on the stack is removed from the stack and discarded (S107). The source code structure analysis unit 11 continues this operation until the stack becomes empty or the indentation width of the element at the top of the stack becomes smaller than the indentation width of the target line.
  • step S107 is a process for searching for candidates for the parent of the target row. That is, the source code structure analysis unit 11 extracts elements stacked on the stack until an element with an indentation width smaller than that of the target line is found. identify as the parent of A parent is a parent node in the tree structure (hierarchical structure) of the source code.
  • the source code structure analysis unit 11 generates a node (hereinafter referred to as "target node") that includes the line number of the target line as an element (S108). Subsequently, the source code structure analysis unit 11 identifies the parent node of the target node (S109). Specifically, when the stack is empty after step S107 (that is, when the parent of the target line is not found), the source code structure analysis unit 11 identifies the root node as the parent node. On the other hand, if the stack is not empty (that is, if the parent of the target line is found), the source code structure analysis unit 11 selects the node that the top element of the stack (that is, the element related to the parent of the target line) has a reference. Identifies it as a parent node.
  • the source code structure analysis unit 11 generates ordered nodes (having the target node as an element) including the target node (S110). At this time, the source code structure analysis unit 11 identifies the index, which is the element of the ordered node, based on the parent node of the target node. Specifically, if the parent node does not have an ordered node, the source code structure analysis unit 11 sets the index to 0; A value obtained by adding 1 is used as the index.
  • the source code structure analysis unit 11 adds the generated ordered node as one of the ordered nodes of the parent node (S111).
  • the source code structure analysis unit 11 adds an element including the indent width of the target line and the reference to the target node to the top of the stack (S112).
  • program structure information is generated (derived) for each file.
  • the program structure information is information representing a tree structure (hierarchical structure) in which lines with relatively small indentation are parent nodes and lines with relatively large indentation are child nodes.
  • the source code structure analysis unit 11 associates each piece of program structure information with the file name of the source code file that generated the program structure information.
  • FIG. 7 is a diagram showing an example of program structure information.
  • (1) is an example of source code
  • (2) is program structure information generated for the source code of (1).
  • italic numbers indicate indexes
  • non-italic numbers indicate line numbers.
  • the program structure information holds the parent-child relationship and adjacency relationship (back-and-forth relationship) of each line of the source code.
  • WebAPI definition information generation unit 12 uses the input WebAPI definition information elements and the program structure information obtained from the source code structure analysis unit 11 to output a list of WebAPI definition information.
  • WebAPI definition information element File name Line number
  • the token in the WebAPI definition information element is a character indicating the WebAPI definition information element (HTTP method or path component) column
  • the element type identifier is an identifier for distinguishing whether the relevant WebAPI definition information element is an HTTP method or a component of a path.
  • the file name and line number represent the file name of the file containing the WebAPI definition information element among the files of the Web application, and the line number of the line containing the WebAPI definition information element in the file.
  • the HTTP method and path in the WebAPI definition information are character strings indicating the HTTP method or path related to the WebAPI, respectively.
  • the relationship between each WebAPI definition information element includes "hierarchical relationship between paths” and “relationship between paths and HTTP methods”.
  • each of "/user” and "/ ⁇ id ⁇ " is a WebAPI definition information element that constitutes a path.
  • /user/ ⁇ id ⁇ is the Web API path.
  • the Web API definition information elements of the path and HTTP method may be defined in the same line or adjacent lines of the source code, or the line where one is defined may be a component of the line where the other is defined.
  • the HTTP method WebAPI definition element "Get” and the WebAPI definition information elements "/user” and “/ ⁇ id ⁇ ” as path components are combined.
  • the WebAPI definition information is configured in this way.
  • FIG. 10 is a flowchart for explaining an overview of the processing procedure executed by the WebAPI definition information generation unit 12.
  • the WebAPI definition information generation unit 12 first adds (corresponds to) the information of the WebAPI definition information element corresponding to the node of the program structure information (S200).
  • the WebAPI definition information generation unit 12 uses the structure indicated by the program structure information to combine (combine) the WebAPI definition information elements that make up the paths, thereby generating a path list (S300).
  • the WebAPI definition information generation unit 12 searches for the WebAPI definition information element of the HTTP method corresponding to each path forming the list, and generates a list of WebAPI definition information by associating the searched WebAPI definition information elements. (S400).
  • FIG. 11 is a flowchart for explaining a processing procedure for adding a WebAPI definition information element to a node of program structure information.
  • the WebAPI definition information generation unit 12 executes loop processing L3 for each WebAPI definition information element searched by the WebAPI definition information element search device 20 from the source code of the Web application.
  • a WebAPI definition information element to be processed in loop processing L3 is hereinafter referred to as a "target definition information element".
  • step S201 the WebAPI definition information generation unit 12 selects the program structure information corresponding to the file name included in the target definition information element (generated for the file associated with the file name) as a processing target.
  • program structure information selected as a processing target is referred to as "target structure information”.
  • the WebAPI definition information generation unit 12 searches for a node (hereinafter referred to as "target node") that includes a line number that matches the line number of the target definition information element from the target structure information (S202). Specifically, the WebAPI definition information generation unit 12 recursively selects ordered nodes of child elements from the root node in the target structure information, and compares the line number of each node with the line number of the target definition information element. . The WebAPI definition information generation unit 12 identifies a node whose line number matches the object definition information element as an object node.
  • FIG. 12 is a diagram for explaining an example of the processing procedure of the path list generation processing.
  • the processing procedure shown in FIG. 12 shows processing for generating a list of paths by performing a depth-first search (in order of precedence) on the tree structure indicated by the program structure information.
  • the WebAPI definition information generation unit 12 executes loop processing L4 for all program structure information (program structure information to which WebAPI definition information elements have been added).
  • the program structure information to be processed in the loop processing L4 is hereinafter referred to as "target structure information”.
  • step S301 the WebAPI definition information generation unit 12 generates an empty stack. Subsequently, the WebAPI definition information generation unit 12 selects the root node of the target structure information as a processing target (S302).
  • a node to be processed will be referred to as a "target node”.
  • the root node here is a virtual node whose child nodes are the root node defined above (a set of 0 or more ordered nodes).
  • the WebAPI definition information generation unit 12 determines whether the target node has the WebAPI definition information element of the path (S303). That is, the WebAPI definition information generation unit 12 determines whether or not the target node has a WebAPI definition information element and the element type identifier of the WebAPI definition information element is a value indicating a path.
  • step S305 If the target node does not have the WebAPI definition information element of the path (No in S303), proceed to step S305. This is because all nodes are processed in a depth-first manner even if a node in the middle of searching does not have a WebAPI definition information element.
  • the WebAPI definition information generation unit 12 combines the token of the WebAPI definition information element after the currently constructed path (S304). If the beginning of the token is not "/" (a symbol that separates paths), the WebAPI definition information generation unit 12 combines "/" after the currently constructed path, and then combines the token. If there is no path currently being constructed, the path being constructed is treated as an empty character string. Subsequently, the process proceeds to step S305.
  • step S305 the WebAPI definition information generation unit 12 generates a list of the currently configured path, the node that last updated the currently configured path, and unprocessed nodes among the child nodes (ordered nodes) of the target node. and are added to the top of the stack as a set of three.
  • the ⁇ node that last updated the path currently being constructed'' is the target node if the target node has the WebAPI definition information element of the path, and if not, it is the target node that has the WebAPI definition information element at the end. It is the determined node.
  • the WebAPI definition information generating unit 12 determines whether or not the list of unprocessed nodes includes the element (S306). That is, it is determined whether or not there is one or more unprocessed child nodes. If the list of unprocessed child nodes includes an element (Yes in S306), the WebAPI definition information generation unit 12 selects the node with the smallest index value in the list of unprocessed child nodes as a processing target. (S307), and repeats steps S304 and subsequent steps Note that selecting the node with the smallest index value in the list of unprocessed child nodes for processing is a method of processing all nodes without omission. This is an example, and as long as it is possible to distinguish whether each node is processed or not, an unprocessed child node may be randomly selected as a processing target.
  • the WebAPI definition information generation unit 12 removes the element including the included path from the path list. For example, if the path list contains a path "/user” and the path currently being constructed is "/user/ ⁇ id ⁇ ", the WebAPI definition information generation unit 12 generates "/ remove the element containing the path "user" from the path list.
  • the WebAPI definition information generation unit 12 deletes the element at the top of the stack (S309).
  • the process of sequentially processing the child nodes of the node related to the element after processing one child node, it is necessary to hold the element on the stack in order to restore the state before processing the next child node. This is because there is no longer any unprocessed child node, so there is no longer a need to hold the element in the stack.
  • the WebAPI definition information generation unit 12 determines whether the stack is empty (S310). If the stack is not empty (No in S310), the WebAPI definition information generator 12 reads the list of the node that last updated the path currently being constructed and the unprocessed child nodes from the top element of the stack (S311). . Subsequently, the WebAPI definition information generation unit 12 selects the most indexed child node that remains in the list of unprocessed child nodes even though the process has been completed. The small node is treated as a processed node (the node is deleted from the unprocessed child node list), and the remaining unprocessed child node list is processed, and steps S306 and subsequent steps are repeated.
  • the WebAPI definition information generation unit 12 outputs a path list based on the target structure information (S312). That is, a path list is generated for each program structure information.
  • FIG. 13 is a flowchart for explaining an example of a processing procedure for generating a list of WebAPI definition information.
  • the WebAPI definition information generation unit 12 executes loop processing L5 including loop processing L6 and step S406 for each path list generated for each program structure information.
  • a path list to be processed in the loop processing L5 is hereinafter referred to as a "target path list”.
  • a loop process L6 is a loop process for each element (path) of the target path list, and includes steps S401 to S405.
  • An element to be processed in loop processing L6 is hereinafter referred to as a "target element”.
  • step S401 the WebAPI definition information generation unit 12 acquires the path and the node (hereinafter referred to as the "target node") that last updated the path (hereinafter referred to as the "target path”) from the target element.
  • the node that last updated the path is the node that has the token linked to the lowest layer of the path.
  • the WebAPI definition information generation unit 12 determines that the program structure information to which the target node belongs (that is, the program structure information corresponding to the target path list) is adjacent to the target node (has a relationship of immediately before and after in the source code). ) nodes (ordered nodes whose indices are different by 1 among sibling nodes having a common parent node) and the target node are searched for a node having the WebAPI definition information element of the HTTP method (S402).
  • the WebAPI definition information generating unit 12 generates WebAPI definition information by combining the HTTP method and target path of each applicable node, and The definition information is added to the list of WebAPI definition information (S403).
  • steps S402 and S403 are processes corresponding to examples defined in the same line and examples defined in adjacent lines in the "relationship between paths and HTTP methods" described above.
  • the WebAPI definition information generation unit 12 searches for a child node having the WebAPI definition information element of the HTTP method among the child nodes of the target node (S404).
  • the WebAPI definition information generation unit 12 When one or more applicable child nodes are found, the WebAPI definition information generation unit 12 generates WebAPI definition information by combining the HTTP method and target path of each applicable child node. The WebAPI definition information is added to the list of WebAPI definition information (S405).
  • the WebAPI definition information generation unit 12 When the loop processing L6 is executed for all the elements of the target path list, the WebAPI definition information generation unit 12 outputs the list of WebAPI definition information generated for the target path list (S406).
  • the present embodiment it is possible to automatically generate WebAPI definition information without depending on Web application documents. That is, since the WebAPI definition information is automatically generated based on the elements of the WebAPI definition information searched from the source code, it is possible to solve the problem of the discrepancy between the implementation of the Web application and the automatically generated WebAPI definition information. . In addition, by estimating the relationship between elements from the result of structural analysis using indentation, it is possible to automatically generate WebAPI definition information from a wide range of Web applications without depending on the grammar of a specific programming language.
  • the source code structure analysis unit 11 is an example of an analysis unit.
  • the WebAPI definition information generator 12 is an example of a generator.
  • WebAPI definition information generation device 11
  • Source code structure analysis unit 12
  • WebAPI definition information generation unit 20
  • WebAPI definition information element search device 100
  • Drive device 101
  • Recording medium 102
  • Auxiliary storage device 103
  • Memory device 104
  • CPU 105 interface device 106 display device 107 input device B bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

A web API definition information generation device according to the present invention comprises: an analysis unit that generates, on the basis of the indent width of each row in the source code of a web application, information in which the parent-child relationship and the adjacency relationship between the rows in the source code are maintained; and a generation unit that combines, on the basis of the parent-child relationship and the adjacency relationship, constituent elements of a web API which are included in the source code together to generate definition information pertaining to the web API. Thus, the web API definition information generation device makes it possible to automatically generate web API definition information without depending on a document of a web application.

Description

WebAPI定義情報生成装置、WebAPI定義情報生成方法及びプログラムWeb API definition information generation device, Web API definition information generation method and program
 本発明は、WebAPI定義情報生成装置、WebAPI定義情報生成方法及びプログラム
に関する。
The present invention relates to a WebAPI definition information generation device, a WebAPI definition information generation method, and a program.
 Webアプリケーションは、要求されたHTTPリクエストの内容に応じて処理を実行し、HTTPレスポンスを返却する。WebアプリケーションがどのようなHTTPリクエストを受け付けるかというWebAPIの情報は、WebアプリケーションのテストやWebアプリケーションを利用するクライアントアプリケーションの作成の際に必要である。具体的には、一つのWebアプリケーションには0個以上のWebAPIが存在し、それぞれのWebAPIについて、リクエストを待ち受けるURLのパス、受け付けるHTTPメソッド、リクエストパラメータに関する定義情報が必要となる。 The web application executes processing according to the content of the requested HTTP request and returns an HTTP response. Web API information indicating what kind of HTTP requests a Web application accepts is necessary when testing a Web application or creating a client application that uses the Web application. Specifically, one web application has zero or more web APIs, and each web API requires definition information about the path of the URL that waits for requests, the HTTP method that is accepted, and the request parameters.
 Webアプリケーションのテストやクライアントアプリケーションの作成を効率的に行うためには、WebAPIの定義情報が、機械的に処理できるように定型的なフォーマットで記述されたドキュメントとして提供されていることが望ましい。例えば、図1に示すように、WebAPI定義情報の記述のための仕様であるOpenAPI仕様に基づいて、YAML形式でWebAPI定義情報が記述されている場合、WebAPI定義情報を機械的に処理することが容易である。 In order to efficiently test web applications and create client applications, it is desirable that web API definition information be provided as a document written in a fixed format so that it can be processed mechanically. For example, as shown in FIG. 1, when the WebAPI definition information is described in YAML format based on the OpenAPI specification, which is a specification for describing the WebAPI definition information, the WebAPI definition information can be mechanically processed. Easy.
 一方、WebAPIの定義情報を図1のように定型的なフォーマットで記述したドキュメントは必ずしも提供されるとは限らない。提供されない場合についてはWebAPIの記述に専用のフォーマット以外で記述されたファイルからWebAPI定義情報が取り出される。この際、WebAPIのパスやHTTPメソッドなどのWebAPI定義情報の個々の要素をファイル中から探索した上で、それぞれの要素を組み合わせて一つのWebAPIとして取り出す必要がある。 On the other hand, it is not always possible to provide a document that describes WebAPI definition information in a fixed format as shown in Figure 1. If it is not provided, the WebAPI definition information is extracted from a file written in a format other than the dedicated format for the WebAPI description. At this time, it is necessary to search the file for individual elements of the WebAPI definition information such as the WebAPI path and HTTP method, and then combine the elements to extract one WebAPI.
 このとき、個々の要素同士の関係は明示されていないため、何らかの手段で推定する必要がある。 At this time, the relationship between individual elements is not specified, so it must be estimated by some means.
 このような場合に利用される従来技術として、人間が読むことを目的にHTMLで記述されたWebアプリケーションのドキュメントから、WebAPIの定義情報を抽出する技術がある(非特許文献1)。この技術によれば、HTMLドキュメントの中からWebAPI定義情報の要素であるパス及びHTTPメソッドを発見することができる。さらにそのドキュメントから構成したDOMツリーの構造を利用して各要素間の対応関係を推定し、各要素を結合することで、自動的にWebAPIの定義情報を得ることができる。例えば、パスが"user/{id}"、HTTPメソッドが"get"のWebAPI定義情報が、図2の(1)~(3)に示す3つのパターンのいずれの形式で記述されている場合でも、DOMツリーの構造からそれぞれの要素を関連付け、一つのWebAPI定義情報として出力することができる。 As a conventional technique used in such cases, there is a technique for extracting WebAPI definition information from a Web application document written in HTML for the purpose of being read by humans (Non-Patent Document 1). According to this technique, it is possible to discover the path and HTTP method, which are the elements of the WebAPI definition information, from within the HTML document. Further, by using the structure of the DOM tree constructed from the document to estimate the correspondence between each element and linking each element, it is possible to automatically obtain WebAPI definition information. For example, even if WebAPI definition information with a path of "user/{id}" and an HTTP method of "get" is described in any of the three patterns shown in (1) to (3) in FIG. , each element can be associated from the structure of the DOM tree and output as one piece of WebAPI definition information.
 しかしながら、従来技術では、Webアプリケーションのドキュメントが、作成されない・更新されない・誤りを含むなどの原因により実際の実装と乖離した場合に正しいWebAPI定義情報を得ることができない。また、従来技術は、DOMツリーを利用したWebAPI定義情報の要素の結合を行うため、DOMツリーを利用しない他のフォーマットへの適用が困難である。 However, with the conventional technology, correct WebAPI definition information cannot be obtained when the document of the Web application is not created, is not updated, contains errors, or otherwise deviates from the actual implementation. In addition, since the conventional technology combines the elements of the WebAPI definition information using the DOM tree, it is difficult to apply it to other formats that do not use the DOM tree.
 本発明は、上記の点に鑑みてなされたものであって、Webアプリケーションのドキュメントに依存することなくWebAPIの定義情報の自動生成を可能にすることを目的とする。 The present invention has been made in view of the above points, and an object of the present invention is to enable automatic generation of WebAPI definition information without depending on Web application documents.
 そこで上記課題を解決するため、WebAPI定義情報生成装置は、Webアプリケーションのソースコードにおける各行のインデント幅に基づいて、前記ソースコードにおける各行の親子関係と隣接関係とを保持した情報を生成する解析部と、前記ソースコードに含まれているWebAPIの構成要素を、前記親子関係と前記隣接関係とに基づいて組み合わせることで、当該WebAPIの定義情報を生成する生成部と、を有する。 Therefore, in order to solve the above problem, the WebAPI definition information generation device includes an analysis unit that generates information that holds the parent-child relationship and the adjacency relationship of each line in the source code of the Web application, based on the indentation width of each line in the source code of the Web application. and a generation unit that generates definition information of the WebAPI by combining WebAPI components included in the source code based on the parent-child relationship and the adjacency relationship.
 Webアプリケーションのドキュメントに依存することなくWebAPIの定義情報の自動生成を可能にすることができる。 It is possible to automatically generate web API definition information without depending on the web application document.
YAML形式で記述されたWebAPI定義情報の一例を示す図である。FIG. 3 is a diagram showing an example of WebAPI definition information described in YAML format; HTMLドキュメント中のWebAPI定義情報の一例を示す図である。FIG. 4 is a diagram showing an example of WebAPI definition information in an HTML document; 本発明の実施の形態におけるWebAPI定義情報生成装置10のハードウェア構成例を示す図である。1 is a diagram showing a hardware configuration example of a WebAPI definition information generating device 10 according to an embodiment of the present invention; FIG. 本発明の実施の形態におけるWebAPI定義情報生成装置10の機能構成例を示す図である。1 is a diagram showing a functional configuration example of a WebAPI definition information generating device 10 according to an embodiment of the present invention; FIG. インデントを説明するための図である。FIG. 4 is a diagram for explaining indentation; ソースコード構造解析部11が実行する処理手順の一例を説明するためのフローチャートである。4 is a flowchart for explaining an example of a processing procedure executed by a source code structure analysis unit 11; プログラム構造情報の一例を示す図である。FIG. 4 is a diagram showing an example of program structure information; ソースコード中におけるパスの定義の一例を示す図である。FIG. 4 is a diagram showing an example of a path definition in a source code; FIG. パスとHTTPメソッドのWebAPI定義情報要素のソースコード上での定義例を示す図である。FIG. 10 is a diagram showing an example of definition on a source code of WebAPI definition information elements of a path and an HTTP method; WebAPI定義情報生成部12が実行する処理手順の概要を説明するためのフローチャートである。4 is a flowchart for explaining an outline of a processing procedure executed by a WebAPI definition information generation unit 12; プログラム構造情報のノードへのWebAPI定義情報要素の追加処理の処理手順を説明するためのフローチャートである。FIG. 11 is a flowchart for explaining a processing procedure for adding a WebAPI definition information element to a node of program structure information; FIG. パスリストの生成処理の処理手順の一例を説明するための図である。FIG. 10 is a diagram for explaining an example of a processing procedure of path list generation processing; WebAPI定義情報のリストの生成処理の処理手順の一例を説明するためのフローチャートである。FIG. 11 is a flowchart for explaining an example of a processing procedure for generating a list of WebAPI definition information; FIG.
 本実施の形態では、Webアプリケーションのソースコード中から探索されたWebAPIの定義情報の要素のそれぞれの関係を推定して要素の結合を行い、WebAPIの定義情報の一覧を出力するWebAPI定義情報生成装置10が開示される。WebAPIの定義情報の要素間の関係を推定するために、本実施の形態では、ソースコードのインデントを利用して、ソースコードの構造が解析される。 In the present embodiment, a WebAPI definition information generation device that estimates the relationship between elements of WebAPI definition information searched from the source code of a Web application, combines the elements, and outputs a list of WebAPI definition information. 10 is disclosed. In this embodiment, indentation of the source code is used to analyze the structure of the source code in order to estimate the relationship between the elements of the WebAPI definition information.
 以下、図面に基づいて本発明の実施の形態を説明する。図3は、本発明の実施の形態におけるWebAPI定義情報生成装置10のハードウェア構成例を示す図である。図3のWebAPI定義情報生成装置10は、それぞれバスBで相互に接続されているドライブ装置100、補助記憶装置102、メモリ装置103、CPU104、インタフェース装置105、表示装置106、及び入力装置107等を有する。 Embodiments of the present invention will be described below based on the drawings. FIG. 3 is a diagram showing a hardware configuration example of the WebAPI definition information generation device 10 according to the embodiment of the present invention. The WebAPI definition information generation device 10 of FIG. have.
 WebAPI定義情報生成装置10での処理を実現するプログラムは、CD-ROM等の記録媒体101によって提供される。プログラムを記憶した記録媒体101がドライブ装置100にセットされると、プログラムが記録媒体101からドライブ装置100を介して補助記憶装置102にインストールされる。但し、プログラムのインストールは必ずしも記録媒体101より行う必要はなく、ネットワークを介して他のコンピュータよりダウンロードするようにしてもよい。補助記憶装置102は、インストールされたプログラムを格納すると共に、必要なファイルやデータ等を格納する。 A program that implements processing in the WebAPI definition information generation device 10 is provided by a recording medium 101 such as a CD-ROM. When the recording medium 101 storing the program is set in the drive device 100 , the program is installed from the recording medium 101 to the auxiliary storage device 102 via the drive device 100 . However, the program does not necessarily need to be installed from the recording medium 101, and may be downloaded from another computer via the network. The auxiliary storage device 102 stores installed programs, as well as necessary files and data.
 メモリ装置103は、プログラムの起動指示があった場合に、補助記憶装置102からプログラムを読み出して格納する。CPU104は、メモリ装置103に格納されたプログラムに従ってWebAPI定義情報生成装置10に係る機能を実現する。インタフェース装置105は、ネットワークに接続するためのインタフェースとして用いられる。表示装置106はプログラムによるGUI(Graphical User Interface)等を表示する。入力装置107はキーボード及びマウス等で構成され、様々な操作指示を入力させるために用いられる。 The memory device 103 reads and stores the program from the auxiliary storage device 102 when a program activation instruction is received. The CPU 104 implements functions related to the WebAPI definition information generation device 10 according to programs stored in the memory device 103 . The interface device 105 is used as an interface for connecting to a network. A display device 106 displays a program-based GUI (Graphical User Interface) or the like. The input device 107 is composed of a keyboard, a mouse, etc., and is used to input various operational instructions.
 図4は、本発明の実施の形態におけるWebAPI定義情報生成装置10の機能構成例を示す図である。図4に示されるように、WebAPI定義情報生成装置10は、ソースコード構造解析部11及びWebAPI定義情報生成部12を有する。これら各部は、WebAPI定義情報生成装置10にインストールされた1以上のプログラムが、CPU104に実行させる処理により実現される。 FIG. 4 is a diagram showing a functional configuration example of the WebAPI definition information generation device 10 according to the embodiment of the present invention. As shown in FIG. 4 , the WebAPI definition information generation device 10 has a source code structure analysis unit 11 and a WebAPI definition information generation unit 12 . Each of these units is realized by processing that one or more programs installed in the WebAPI definition information generation device 10 cause the CPU 104 to execute.
 ソースコード構造解析部11は、Webアプリケーションのソースコード(以下、単に「ソースコード」という。)のインデント(字下げ)を手がかりとし、ソースコードの構造を導出(ソースコードの構造を示す情報を生成)する。 The source code structure analysis unit 11 derives the structure of the source code (generates information indicating the structure of the source code) based on the indentation of the source code of the Web application (hereinafter simply referred to as "source code"). )do.
 WebAPI定義情報生成部12は、ソースコードから探索(抽出)されたWebAPI定義情報の構成要素(WebAPI定義情報要素)とソースコードの構造情報とを入力として、要素間の関係を推定し、推定結果に基づいて要素を結合してWebAPI定義情報を生成する。 The WebAPI definition information generation unit 12 receives as inputs the components of the WebAPI definition information (WebAPI definition information elements) searched (extracted) from the source code and the structural information of the source code, estimates the relationship between the elements, and estimates the result. The elements are combined based on to generate the WebAPI definition information.
 なお、図4において、ソースコードからのWebAPI定義情報要素の探索(抽出)は、WebAPI定義情報要素探索装置20が実行する。但し、WebAPI定義情報生成装置10が斯かる探索をも実行してもよい。ソースコードからのWebAPI定義情報要素の探索は、例えば、正規表現を利用した文字列検索などの公知技術を利用して実現することができる。 In FIG. 4, the WebAPI definition information element search device 20 executes the search (extraction) of the WebAPI definition information element from the source code. However, the WebAPI definition information generating device 10 may also perform such a search. The search for the WebAPI definition information element from the source code can be realized using known techniques such as character string search using regular expressions, for example.
 以下、各部について更に詳細に説明する。 Each part will be explained in more detail below.
 [ソースコード構造解析部11]
 テキストでソースコードを記述するプログラミング言語の多くでは、構文上で改行やホワイトスペースの挿入が必要または許されている箇所において、連続して複数の改行やホワイトスペースを挿入した場合であっても単一の改行やホワイトスペースを挿入した場合と同様に解釈される。構文上必要最小限の数の改行やホワイトスペースのみでは、人間が理解又は編集するにあたっては不十分であるため、通常は連続して挿入する改行やホワイトスペースの個数を調節することでソースコードの整形が行われる。
[Source code structure analysis unit 11]
In many programming languages where source code is written as text, even if multiple consecutive line breaks or white spaces are inserted where line breaks or white spaces are required or allowed by the syntax, Interpreted as if you had inserted a single newline or whitespace. The minimum number of line breaks and white spaces necessary for syntax is insufficient for human understanding and editing. shaping is done.
 プログラミング言語の構文は、或る文を構成する要素として別の文を持つ再帰的な構造を持つ。ソースコードを整形する際に広く用いられている慣習として、各文の末尾に改行を挿入する。その上で、或る文の構成要素として別の文を記述した場合、当該別の文の行頭に、当該或る文よりも多数のホワイトスペースを挿入する。このようにホワイトスペースによって字下げすることを「インデントする」と呼ぶ。また、行頭の連続するホワイトスペースの個数を「インデント幅」と呼ぶ。 The programming language syntax has a recursive structure that has another sentence as an element that constitutes another sentence. A common practice in formatting source code is to insert a line break at the end of each sentence. In addition, when another sentence is described as a component of a certain sentence, more white spaces than the certain sentence are inserted at the beginning of the line of the other sentence. Indenting with white space in this way is called "indenting". Also, the number of consecutive white spaces at the beginning of a line is called "indentation width".
 例えば、図5に示す例において、outer_blockは、inner_block_1及びinner_block_2を構成要素として含む。各構成要素についてインデント幅2のインデントが行われることで、各構成要素がouter_blockの構成要素であることが視覚的に判断しやすいよう整形されている。 For example, in the example shown in FIG. 5, outer_block includes inner_block_1 and inner_block_2 as components. By indenting each component with an indentation width of 2, each component is shaped so that it is easy to visually determine that it is a component of outer_block.
 ソースコード構造解析部11は、ソースコードがどのようにインデントされているか(ソースコードにおける各行のインデントの態様)を解析することによって、プログラミング言語ごとに定義された構文に依存せずに文の階層構造を解析する。ソースコード構造解析部11は、解析結果として一つのファイル(ソースコードが記録されたファイル)につき以下のプログラム構造情報を一つ出力する。なお、以下の定義は、BNF(Backus-Naur form)記法に基づく。
プログラム構造情報::==ルートノード
ルートノード::==順序付きノード*
順序付きノード::==インデックス ノード
ノード::==行番号 順序付きノード*
 上記によれば、「ルートノード」とは、順序付きノードの0以上の集合を表現する。なお、順序付きノードの要素であるインデックスは、同じ親ノードを有するノード群の中で、各ノードを一意に識別する値であって、かつ、ソースコード上の出現順を示す自然数である。また、ノードの要素の順序付きノードは、当該ノードの子ノードである。ノードが、子ノードである順序付きノードを要素として含むことで、木構造(再帰的な構造)が表現される。
The source code structure analysis unit 11 analyzes how the source code is indented (the manner of indentation of each line in the source code), thereby analyzing the hierarchy of sentences without depending on the syntax defined for each programming language. Analyze structure. The source code structure analysis unit 11 outputs the following program structure information for each file (file in which source code is recorded) as an analysis result. The definitions below are based on the BNF (Backus-Naur form) notation.
program structure information ::== root node root node ::== ordered node *
ordered node::==index node node::==line number ordered node*
According to the above, a "root node" represents a set of zero or more ordered nodes. An index, which is an element of an ordered node, is a value that uniquely identifies each node in a group of nodes having the same parent node, and is a natural number that indicates the order of appearance in the source code. Also, the ordered nodes of the elements of the node are the child nodes of the node. A tree structure (recursive structure) is represented by a node including ordered nodes, which are child nodes, as elements.
 ソースコード構造解析部11が実行する処理手順について説明する。 A processing procedure executed by the source code structure analysis unit 11 will be described.
 図6は、ソースコード構造解析部11が実行する処理手順の一例を説明するためのフローチャートである。ソースコード構造解析部11は、或るWebアプリケーションのソースコードファイルの一覧に含まれるファイルごとにループ処理L1を実行する。ループ処理L1において処理対象とされる一つのファイルを、以下「対象ファイル」という。 FIG. 6 is a flowchart for explaining an example of a processing procedure executed by the source code structure analysis unit 11. FIG. The source code structure analysis unit 11 executes loop processing L1 for each file included in a list of source code files of a Web application. One file to be processed in the loop processing L1 is hereinafter referred to as a "target file".
 ステップS101において、ソースコード構造解析部11は、順序付きノードを持たないルートノードを生成する。続いて、ソースコード構造解析部11は、空のスタックを生成する(S102)。このスタックはインデント幅とノードへの参照との組を要素として格納することができる。 In step S101, the source code structure analysis unit 11 generates a root node without ordered nodes. Subsequently, the source code structure analysis unit 11 creates an empty stack (S102). This stack can store pairs of indent widths and references to nodes as elements.
 続いて、ソースコード構造解析部11は、対象ファイルを開く(S103)。続いて、ソースコード構造解析部11は、対象ファイルの1行ごとに、ステップS104~S112を含むループ処理L2を実行する。ループ処理L2は、対象ファイルの全ての行について実行される。 Next, the source code structure analysis unit 11 opens the target file (S103). Subsequently, the source code structure analysis unit 11 executes loop processing L2 including steps S104 to S112 for each line of the target file. Loop processing L2 is executed for all lines of the target file.
 ステップS104において、ソースコード構造解析部11は、対象ファイルにおいて未処理の行のうち先頭の行(以下、「対象行」という。)を読み込む。続いて、ソースコード構造解析部11は、対象行が空行であるか否かを判定する(S105)。対象行が空行である場合、(S105でYes)、ソースコード構造解析部11は、対象行についてステップS106以降を実行しない。 In step S104, the source code structure analysis unit 11 reads the first line (hereinafter referred to as "target line") among the unprocessed lines in the target file. Subsequently, the source code structure analysis unit 11 determines whether the target line is a blank line (S105). If the target line is a blank line (Yes in S105), the source code structure analysis unit 11 does not execute step S106 and subsequent steps for the target line.
 対象行が空行でない場合(S105でNo)、ソースコード構造解析部11は、対象行のインデント幅を取得する(S106)。続いて、ソースコード構造解析部11は、対象行のインデント幅とスタックの先頭(トップ)の要素のインデント幅とを比べ、両者が一致する場合か対象行のインデント幅の方が小さい場合にはスタック上の先頭の要素をスタックから取り出して破棄する(S107)。ソースコード構造解析部11は、スタックが空になるか、スタックの先頭の要素のインデント幅が対象行のインデント幅よりも真に小さくなるまでこの操作を続ける。 If the target line is not blank (No in S105), the source code structure analysis unit 11 acquires the indentation width of the target line (S106). Next, the source code structure analysis unit 11 compares the indentation width of the target line with the indentation width of the element at the top of the stack, and if the two match or if the indentation width of the target line is smaller, The top element on the stack is removed from the stack and discarded (S107). The source code structure analysis unit 11 continues this operation until the stack becomes empty or the indentation width of the element at the top of the stack becomes smaller than the indentation width of the target line.
 なお、ステップS107は、対象行の親の候補を探索するための処理である。すなわち、ソースコード構造解析部11は、対象行よりもインデント幅が小さい要素が見つかるまでスタックに積まれている要素を取り出し、対象行よりもインデント幅が小さい要素が見つかれば、当該要素を対象行の親として特定する。親とは、ソースコードが有する木構造(階層構造)において親のノードをいう。 Note that step S107 is a process for searching for candidates for the parent of the target row. That is, the source code structure analysis unit 11 extracts elements stacked on the stack until an element with an indentation width smaller than that of the target line is found. identify as the parent of A parent is a parent node in the tree structure (hierarchical structure) of the source code.
 続いて、ソースコード構造解析部11は、対象行の行番号を要素として含むノード(以下、「対象ノード」という。)を生成する(S108)。続いて、ソースコード構造解析部11は、対象ノードの親ノードを特定する(S109)。具体的には、ステップS107の終了後にスタックが空である場合(すなわち、対象行の親が見つからなかった場合)、ソースコード構造解析部11は、ルートノードを親ノードとして特定する。一方、スタックが空でない場合(すなわち、対象行の親が見つかった場合)、ソースコード構造解析部11は、スタックの先頭の要素(すなわち、対象行の親に係る要素)が参照を持つノードを親ノードとして特定する。 Subsequently, the source code structure analysis unit 11 generates a node (hereinafter referred to as "target node") that includes the line number of the target line as an element (S108). Subsequently, the source code structure analysis unit 11 identifies the parent node of the target node (S109). Specifically, when the stack is empty after step S107 (that is, when the parent of the target line is not found), the source code structure analysis unit 11 identifies the root node as the parent node. On the other hand, if the stack is not empty (that is, if the parent of the target line is found), the source code structure analysis unit 11 selects the node that the top element of the stack (that is, the element related to the parent of the target line) has a reference. Identifies it as a parent node.
 続いて、ソースコード構造解析部11は、対象ノードを含む(対象ノードを要素とする)順序付きノードを生成する(S110)。この際、ソースコード構造解析部11は、対象ノードの親ノードに基づいて、当該順序付きノードの要素であるインデックスを特定する。具体的には、ソースコード構造解析部11は、親ノードが順序付きノードを持たない場合には当該インデックスを0とし、そうでない場合には親ノードが持つ順序付きノードの中で最大のインデックスに1を加算した値を当該インデックスとする。 Subsequently, the source code structure analysis unit 11 generates ordered nodes (having the target node as an element) including the target node (S110). At this time, the source code structure analysis unit 11 identifies the index, which is the element of the ordered node, based on the parent node of the target node. Specifically, if the parent node does not have an ordered node, the source code structure analysis unit 11 sets the index to 0; A value obtained by adding 1 is used as the index.
 続いて、ソースコード構造解析部11は、生成した順序付きノードを親ノードの順序付きノードの一つとして追加する(S111)。 Subsequently, the source code structure analysis unit 11 adds the generated ordered node as one of the ordered nodes of the parent node (S111).
 続いて、ソースコード構造解析部11は、対象行のインデント幅と対象ノードへの参照とを含む要素をスタックの先頭へ追加する(S112)。 Subsequently, the source code structure analysis unit 11 adds an element including the indent width of the target line and the reference to the target node to the top of the stack (S112).
 図6の処理手順が終了すると、ファイルごとにプログラム構造情報が生成(導出)される。当該プログラム構造情報は、インデントが相対的に小さい行を親ノードとし、インデントが相対的に大きい行を子ノードとする木構造(階層構造)を表現する情報である。なお、ソースコード構造解析部11は、各プログラム構造情報を、当該プログラム構造情報の生成元のソースコードファイルのファイル名に関連付けておく。 When the processing procedure in FIG. 6 ends, program structure information is generated (derived) for each file. The program structure information is information representing a tree structure (hierarchical structure) in which lines with relatively small indentation are parent nodes and lines with relatively large indentation are child nodes. The source code structure analysis unit 11 associates each piece of program structure information with the file name of the source code file that generated the program structure information.
 図7は、プログラム構造情報の一例を示す図である。図7において、(1)は、ソースコードの一例であり、(2)は、(1)のソースコードに対して生成されるプログラム構造情報である。なお、(2)において、斜体の数宇はインデックスを示し、斜体でない数字は行番号を示す。このように、プログラム構造情報は、ソースコードの各行の親子関係と隣接関係(前後関係)とを保持する。 FIG. 7 is a diagram showing an example of program structure information. In FIG. 7, (1) is an example of source code, and (2) is program structure information generated for the source code of (1). In (2), italic numbers indicate indexes, and non-italic numbers indicate line numbers. Thus, the program structure information holds the parent-child relationship and adjacency relationship (back-and-forth relationship) of each line of the source code.
 [WebAPI定義情報生成部12]
 WebAPI定義情報生成部12は、入力されたWebAPI定義情報要素とソースコード構造解析部11から得たプログラム構造情報を使用してWebAPI定義情報のリストを出力する。
[Web API definition information generation unit 12]
The WebAPI definition information generation unit 12 uses the input WebAPI definition information elements and the program structure information obtained from the source code structure analysis unit 11 to output a list of WebAPI definition information.
 WebAPI定義情報要素及びWebAPI定義情報のそれぞれは以下の通り定義される。
WebAPI定義情報要素::==トークン 要素種別識別子 ファイル名 行番号
WebAPI定義情報 ::==HTTPメソッド パス
 WebAPI定義情報要素におけるトークンは、WebAPI定義情報要素(HTTPメソッド又はパスの構成要素)を示す文字列であり、要素種別識別子は当該WebAPI定義情報要素がHTTPメソッドであるかパスの構成要素であるかを区別するための識別子である。また、ファイル名と行番号は、Webアプリケーションのファイルのうち、当該WebAPI定義情報要素を含むファイルのファイル名と、当該ファイル内において当該WebAPI定義情報要素を含む行の行番号を表す。
Each of the WebAPI definition information element and the WebAPI definition information is defined as follows.
WebAPI definition information element::==Token Element type identifier File name Line number WebAPI definition information ::==HTTP method path The token in the WebAPI definition information element is a character indicating the WebAPI definition information element (HTTP method or path component) column, and the element type identifier is an identifier for distinguishing whether the relevant WebAPI definition information element is an HTTP method or a component of a path. The file name and line number represent the file name of the file containing the WebAPI definition information element among the files of the Web application, and the line number of the line containing the WebAPI definition information element in the file.
 WebAPI定義情報におけるHTTPメソッド、パスはそれぞれWebAPIに係るHTTPメソッド又はパスを示す文字列である。 The HTTP method and path in the WebAPI definition information are character strings indicating the HTTP method or path related to the WebAPI, respectively.
 各WebAPI定義情報要素間の関係には、「パス間の階層関係」と「パスとHTTPメソッド間の関係」とが存在する。 The relationship between each WebAPI definition information element includes "hierarchical relationship between paths" and "relationship between paths and HTTP methods".
 <パス間の階層関係>
 パスはスラッシュ("/")で区切られた階層構造を持つため、ソースコード中でも例えば図8に示されるように階層的に定義される場合がある。図8の例では、"/user"及び"/{id}"のそれぞれは、パスを構成するWebAPI定義情報要素であり、プログラム構造情報が示す階層構造と合致するように両者を結合し、"/user/{id}"というパスがWebAPIのパスとなる。
<Hierarchical relationship between paths>
Since the path has a hierarchical structure separated by slashes ("/"), it may be defined hierarchically even in the source code, for example, as shown in FIG. In the example of FIG. 8, each of "/user" and "/{id}" is a WebAPI definition information element that constitutes a path. /user/{id}" is the Web API path.
 <パスとHTTPメソッド間の関係>
 パスとHTTPメソッドのWebAPI定義情報要素はそれぞれソースコードの同一行若しくは隣接行で定義されるか、又は片方の定義されている行が他方の定義されている行の構成要素となっている場合が多い。図9の(1)は、同一行に定義されている例を示す。図9の(2)は、隣接行で定義されている例を示す。図9の(3)は、片方の定義されている行が他方の定義されている行の構成要素となっている例を示す。
<Relationship between paths and HTTP methods>
The Web API definition information elements of the path and HTTP method may be defined in the same line or adjacent lines of the source code, or the line where one is defined may be a component of the line where the other is defined. many. (1) in FIG. 9 shows an example defined in the same line. (2) in FIG. 9 shows an example defined by adjacent lines. (3) in FIG. 9 shows an example in which one defined line is a component of the other defined line.
 図9のいずれの例についても、HTTPメソッドのWebAPI定義上要素である"Get"とパスの構成要素としてのWebAPI定義情報要素である"/user"及び"/{id}"との両者を組み合わせることでWebAPI定義情報が構成される。 For any of the examples in FIG. 9, the HTTP method WebAPI definition element "Get" and the WebAPI definition information elements "/user" and "/{id}" as path components are combined. The WebAPI definition information is configured in this way.
 図10は、WebAPI定義情報生成部12が実行する処理手順の概要を説明するためのフローチャートである。 FIG. 10 is a flowchart for explaining an overview of the processing procedure executed by the WebAPI definition information generation unit 12. FIG.
 WebAPI定義情報生成部12は、まず、プログラム構造情報のノードに対して、当該ノードに対応するWebAPI定義情報要素の情報を追加する(対応付ける)(S200)。 The WebAPI definition information generation unit 12 first adds (corresponds to) the information of the WebAPI definition information element corresponding to the node of the program structure information (S200).
 続いて、WebAPI定義情報生成部12は、プログラム構造情報が示す構造を利用して、パスを構成するWebAPI定義情報要素を結合する(組み合わせる)ことで、パスのリストを生成する(S300)。 Next, the WebAPI definition information generation unit 12 uses the structure indicated by the program structure information to combine (combine) the WebAPI definition information elements that make up the paths, thereby generating a path list (S300).
 続いて、WebAPI定義情報生成部12は、当該リストを構成する各パスに対応するHTTPメソッドのWebAPI定義情報要素を探索し、探索されたWebAPI定義情報要素を関連付けることでWebAPI定義情報のリストを生成する(S400)。 Subsequently, the WebAPI definition information generation unit 12 searches for the WebAPI definition information element of the HTTP method corresponding to each path forming the list, and generates a list of WebAPI definition information by associating the searched WebAPI definition information elements. (S400).
 ステップS200の詳細について説明する。図11は、プログラム構造情報のノードへのWebAPI定義情報要素の追加処理の処理手順を説明するためのフローチャートである。WebAPI定義情報生成部12は、WebアプリケーションのソースコードからWebAPI定義情報要素探索装置20によって探索されたWebAPI定義情報要素ごとにループ処理L3を実行する。ループ処理L3において処理対象とされているWebAPI定義情報要素を、以下「対象定義情報要素」という。 The details of step S200 will be described. FIG. 11 is a flowchart for explaining a processing procedure for adding a WebAPI definition information element to a node of program structure information. The WebAPI definition information generation unit 12 executes loop processing L3 for each WebAPI definition information element searched by the WebAPI definition information element search device 20 from the source code of the Web application. A WebAPI definition information element to be processed in loop processing L3 is hereinafter referred to as a "target definition information element".
 ステップS201において、WebAPI定義情報生成部12は、対象定義情報要素に含まれるファイル名に対応する(当該ファイル名に係るファイルについて生成された)プログラム構造情報を処理対象として選択する。以下、処理対象として選択されたプログラム構造情報を「対象構造情報」という。 In step S201, the WebAPI definition information generation unit 12 selects the program structure information corresponding to the file name included in the target definition information element (generated for the file associated with the file name) as a processing target. Hereinafter, program structure information selected as a processing target is referred to as "target structure information".
 続いて、WebAPI定義情報生成部12は、対象構造情報から、対象定義情報要素の行番号と一致する行番号を含むノード(以下、「対象ノード」という。)を探索する(S202)。具体的には、WebAPI定義情報生成部12は、対象構造情報におけるルートノードから子要素の順序付きノードを再帰的に選択し、各ノードの行番号と対象定義情報要素の行番号とを比較する。WebAPI定義情報生成部12は、対象定義情報要素と行番号が一致するノードを対象ノードとして特定する。 Next, the WebAPI definition information generation unit 12 searches for a node (hereinafter referred to as "target node") that includes a line number that matches the line number of the target definition information element from the target structure information (S202). Specifically, the WebAPI definition information generation unit 12 recursively selects ordered nodes of child elements from the root node in the target structure information, and compares the line number of each node with the line number of the target definition information element. . The WebAPI definition information generation unit 12 identifies a node whose line number matches the object definition information element as an object node.
 続いて、WebAPI定義情報生成部12は、対象ノードに対して対象定義情報要素の情報を追加することで、対象ノードを更新する(S203)。したがって、更新後のノード(WebAPI定義情報要素付きノード)は以下の形式になる。
WebAPI定義情報要素付きノード::==行番号 順序付きノード* WebAPI定義情報要素*
 続いて、図10のステップ300の詳細について説明する。
Subsequently, the WebAPI definition information generating unit 12 updates the target node by adding the information of the target definition information element to the target node (S203). Therefore, the updated node (node with WebAPI definition information element) has the following format.
Node with WebAPI definition information element ::== line number Ordered node* WebAPI definition information element*
Next, details of step 300 in FIG. 10 will be described.
 図12は、パスリストの生成処理の処理手順の一例を説明するための図である。図12が示す処理手順は、プログラム構造情報が示す木構造を深さ優先探索(先行順)してパスのリストを生成する処理を示す。 FIG. 12 is a diagram for explaining an example of the processing procedure of the path list generation processing. The processing procedure shown in FIG. 12 shows processing for generating a list of paths by performing a depth-first search (in order of precedence) on the tree structure indicated by the program structure information.
 WebAPI定義情報生成部12は、全てのプログラム構造情報(WebAPI定義情報要素が追加されたプログラム構造情報)についてループ処理L4を実行する。ループ処理L4において処理対象とされているプログラム構造情報を、以下「対象構造情報」という。 The WebAPI definition information generation unit 12 executes loop processing L4 for all program structure information (program structure information to which WebAPI definition information elements have been added). The program structure information to be processed in the loop processing L4 is hereinafter referred to as "target structure information".
 ステップS301において、WebAPI定義情報生成部12は、空のスタックを生成する。続いて、WebAPI定義情報生成部12は、対象構造情報のルートノードを処理対象として選択する(S302)。以下、処理対象とされたノードを「対象ノード」という。なお、ここでのルートノードは、便宜上、上記において定義したルートノード(0以上の順序付きノードの集合)を子ノードとする仮想的なノードとする。 In step S301, the WebAPI definition information generation unit 12 generates an empty stack. Subsequently, the WebAPI definition information generation unit 12 selects the root node of the target structure information as a processing target (S302). Hereinafter, a node to be processed will be referred to as a "target node". For the sake of convenience, the root node here is a virtual node whose child nodes are the root node defined above (a set of 0 or more ordered nodes).
 続いて、WebAPI定義情報生成部12は、対象ノードがパスのWebAPI定義情報要素を有するか否かを判定する(S303)。すなわち、WebAPI定義情報生成部12は、対象ノードがWebAPI定義情報要素を有し、かつ、当該WebAPI定義情報要素の要素種別識別子がパスを示す値であるか否かを判定する。 Next, the WebAPI definition information generation unit 12 determines whether the target node has the WebAPI definition information element of the path (S303). That is, the WebAPI definition information generation unit 12 determines whether or not the target node has a WebAPI definition information element and the element type identifier of the WebAPI definition information element is a value indicating a path.
 対象ノードがパスのWebAPI定義情報要素を有さない場合(S303でNo)、ステップS305へ進む。探索途中のノードがWebAPI定義情報要素を有さなくても、深さ優先で全てのノードを処理するためである。 If the target node does not have the WebAPI definition information element of the path (No in S303), proceed to step S305. This is because all nodes are processed in a depth-first manner even if a node in the middle of searching does not have a WebAPI definition information element.
 一方、対象ノードがパスのWebAPI定義情報要素を有する場合(S303でYes)、WebAPI定義情報生成部12は、当該WebAPI定義情報要素のトークンを、現在構成中のパスの後に結合する(S304)。なお、当該トークンの先頭が"/"(パスを区切る記号)でない場合、WebAPI定義情報生成部12は、現在構成中のパスの後に"/"を結合し、更にその後に当該トークンを結合する。なお、現在構成中のパスが無い場合には、現在構成中のパスは空文字列として扱われる。続いて、ステップS305へ進む。 On the other hand, if the target node has the WebAPI definition information element of the path (Yes in S303), the WebAPI definition information generation unit 12 combines the token of the WebAPI definition information element after the currently constructed path (S304). If the beginning of the token is not "/" (a symbol that separates paths), the WebAPI definition information generation unit 12 combines "/" after the currently constructed path, and then combines the token. If there is no path currently being constructed, the path being constructed is treated as an empty character string. Subsequently, the process proceeds to step S305.
 ステップS305において、WebAPI定義情報生成部12は、現在構成中のパスと、現在構成中のパスを最後に更新したノードと、対象ノードの子ノード(順序付きノード)のうち未処理のノードのリストとの3つを組にしてスタックの先頭に追加する。なお、「現在構成中のパスを最後に更新したノード」とは、対象ノードがパスのWebAPI定義情報要素を有する場合は対象ノードであり、そうでない場合は、最後にWebAPI定義情報要素を有すると判定されたノードである。 In step S305, the WebAPI definition information generation unit 12 generates a list of the currently configured path, the node that last updated the currently configured path, and unprocessed nodes among the child nodes (ordered nodes) of the target node. and are added to the top of the stack as a set of three. Note that the ``node that last updated the path currently being constructed'' is the target node if the target node has the WebAPI definition information element of the path, and if not, it is the target node that has the WebAPI definition information element at the end. It is the determined node.
 続いて、WebAPI定義情報生成部12は、当該未処理のノードのリストが要素(を含むか否かを判定する(S306)。すなわち、1以上の未処理の子ノードの有無が判定される。当該未処理の子ノードのリストが要素を含む場合(S306でYes)、WebAPI定義情報生成部12は、当該未処理の子ノードのリストの中でインデックスの値が最小のノードを処理対象として選択して(S307)、ステップS304以降を繰り返す。なお、当該未処理の子ノードのリストの中でインデックスの値が最小のノードを処理対象として選択するのは、全てのノードを漏れなく処理する方法の一例であり、各ノードについて処理対象とされたか否かが区別可能であることが担保されれば、ランダムに未処理の子ノードが処理対象として選択されてもよい。 Subsequently, the WebAPI definition information generating unit 12 determines whether or not the list of unprocessed nodes includes the element (S306). That is, it is determined whether or not there is one or more unprocessed child nodes. If the list of unprocessed child nodes includes an element (Yes in S306), the WebAPI definition information generation unit 12 selects the node with the smallest index value in the list of unprocessed child nodes as a processing target. (S307), and repeats steps S304 and subsequent steps Note that selecting the node with the smallest index value in the list of unprocessed child nodes for processing is a method of processing all nodes without omission. This is an example, and as long as it is possible to distinguish whether each node is processed or not, an unprocessed child node may be randomly selected as a processing target.
 一方、当該未処理の子ノードのリストが要素を含まない場合(S306でNo)、スタックの先頭の要素に含まれる、現在構成中のパスと現在構成中のパスを最後に更新したノードとの組をパスリストに追加する(S308)。この際、パスリスト中に現在構成中のパスに完全に包含されるパスが有る場合、WebAPI定義情報生成部12は、当該包含されるパスを含む要素をパスリストから取り除く。例えば、"/user"というパスがパスリストに含まれている場合に、現在構成中のパスが"/user/{id}"であった場合には、WebAPI定義情報生成部12は、"/user"というパスを含む要素をパスリストから取り除く。 On the other hand, if the list of unprocessed child nodes does not contain any elements (No in S306), the path that is currently being constructed and the node that last updated the path that is currently being constructed, which is included in the element at the top of the stack. Add the pair to the path list (S308). At this time, if there is a path that is completely included in the currently configured path in the path list, the WebAPI definition information generation unit 12 removes the element including the included path from the path list. For example, if the path list contains a path "/user" and the path currently being constructed is "/user/{id}", the WebAPI definition information generation unit 12 generates "/ remove the element containing the path "user" from the path list.
 続いて、WebAPI定義情報生成部12は、スタックの先頭の要素を削除する(S309)。当該要素に係るノードの子ノードを順に処理する過程において、一つの子ノードを処理した後、次の子ノードを処理する前に状態を復元するために当該要素をスタックに保持しておく必要が有ったが、未処理の子ノードが無くなったことにより、当該要素をスタックに保持しておく必要が無くなったからである。 Next, the WebAPI definition information generation unit 12 deletes the element at the top of the stack (S309). In the process of sequentially processing the child nodes of the node related to the element, after processing one child node, it is necessary to hold the element on the stack in order to restore the state before processing the next child node. This is because there is no longer any unprocessed child node, so there is no longer a need to hold the element in the stack.
 続いて、WebAPI定義情報生成部12は、スタックが空であるか否かを判定する(S310)。スタックが空でなければ(S310でNo)、WebAPI定義情報生成部12は、現在構成中のパスを最後に更新したノード、未処理の子ノードのリストをスタックの先頭の要素から読み取る(S311)。続いて、WebAPI定義情報生成部12は、読み取った未処理の子ノードのリストのうち、処理が済んだにも関わらず未処理の子ノードのリストに残ったままになっている、最もインデックスの小さいノードを処理済みのノードとし(当該ノードを未処理の子ノードのリストから削除し)、残りの未処理の子ノードのリストを処理対象としてステップS306以降を繰り返す。 Next, the WebAPI definition information generation unit 12 determines whether the stack is empty (S310). If the stack is not empty (No in S310), the WebAPI definition information generator 12 reads the list of the node that last updated the path currently being constructed and the unprocessed child nodes from the top element of the stack (S311). . Subsequently, the WebAPI definition information generation unit 12 selects the most indexed child node that remains in the list of unprocessed child nodes even though the process has been completed. The small node is treated as a processed node (the node is deleted from the unprocessed child node list), and the remaining unprocessed child node list is processed, and steps S306 and subsequent steps are repeated.
 一方、スタックが空であれば(S310でYes)、WebAPI定義情報生成部12は、対象構造情報に基づくパスリストを出力する(S312)。すなわち、パスリストはプログラム構造情報ごとに生成される。 On the other hand, if the stack is empty (Yes in S310), the WebAPI definition information generation unit 12 outputs a path list based on the target structure information (S312). That is, a path list is generated for each program structure information.
 全てのプログラム構造情報について上記の処理手順が実行されると、図12の処理は終了する。 When the above processing procedure is executed for all program structure information, the processing in FIG. 12 ends.
 続いて、図10のステップS400の詳細について説明する。図13は、WebAPI定義情報のリストの生成処理の処理手順の一例を説明するためのフローチャートである。 Next, the details of step S400 in FIG. 10 will be described. FIG. 13 is a flowchart for explaining an example of a processing procedure for generating a list of WebAPI definition information.
 WebAPI定義情報生成部12は、プログラム構造情報ごとに生成されたパスリストごとに、ループ処理L6及びステップS406を含むループ処理L5を実行する。ループ処理L5において処理対象とされているパスリストを、以下「対象パスリスト」という。 The WebAPI definition information generation unit 12 executes loop processing L5 including loop processing L6 and step S406 for each path list generated for each program structure information. A path list to be processed in the loop processing L5 is hereinafter referred to as a "target path list".
 ループ処理L6は、対象パスリストの要素(パス)ごとのループ処理であり、ステップS401~S405を含む。ループ処理L6において処理対象とされている要素を、以下「対象要素」という。 A loop process L6 is a loop process for each element (path) of the target path list, and includes steps S401 to S405. An element to be processed in loop processing L6 is hereinafter referred to as a "target element".
 ステップS401において、WebAPI定義情報生成部12は、対象要素からパスと当該パス(以下、「対象パス」という。)を最後に更新したノード(以下、「対象ノード」という。)とを取得する。なお、当該パスを最後に更新したノードとは、当該パスの最下層に結合されたトークンを有するノードである。 In step S401, the WebAPI definition information generation unit 12 acquires the path and the node (hereinafter referred to as the "target node") that last updated the path (hereinafter referred to as the "target path") from the target element. Note that the node that last updated the path is the node that has the token linked to the lowest layer of the path.
 続いて、WebAPI定義情報生成部12は、対象ノードが属するプログラム構造情報(すなわち、対象パスリストに対応するプログラム構造情報)において、対象ノードに隣接する(ソースコード上で直前・直後の関係に有する)ノード(親ノードが共通の兄弟ノードの中でインデックスが1だけ異なる順序付きノード)と対象ノードとの中からHTTPメソッドのWebAPI定義情報要素を有するノードを探索する(S402)。 Next, the WebAPI definition information generation unit 12 determines that the program structure information to which the target node belongs (that is, the program structure information corresponding to the target path list) is adjacent to the target node (has a relationship of immediately before and after in the source code). ) nodes (ordered nodes whose indices are different by 1 among sibling nodes having a common parent node) and the target node are searched for a node having the WebAPI definition information element of the HTTP method (S402).
 続いて、WebAPI定義情報生成部12は、該当するノードが1以上有れば,該当するノードごとに、当該ノードが有するHTTPメソッドと対象パスとを組み合わせることでWebAPI定義情報を生成し、当該WebAPI定義情報をWebAPI定義情報のリストに追加する(S403)。 Subsequently, if there is one or more applicable nodes, the WebAPI definition information generating unit 12 generates WebAPI definition information by combining the HTTP method and target path of each applicable node, and The definition information is added to the list of WebAPI definition information (S403).
 なお、ステップS402及びS403は、上記で述べた「パスとHTTPメソッド間の関係」のうち、同一行に定義されている例と隣接行で定義されている例とに対応する処理である。 Note that steps S402 and S403 are processes corresponding to examples defined in the same line and examples defined in adjacent lines in the "relationship between paths and HTTP methods" described above.
 続いて、WebAPI定義情報生成部12は、対象ノードの子ノードの中から、HTTPメソッドのWebAPI定義情報要素を有する子ノードを探索する(S404)。 Next, the WebAPI definition information generation unit 12 searches for a child node having the WebAPI definition information element of the HTTP method among the child nodes of the target node (S404).
 該当する子ノードが1以上探索された場合、WebAPI定義情報生成部12は、該当する子ノードごとに、当該子ノードが有するHTTPメソッドと対象パスとを組み合わせることでWebAPI定義情報を生成し、当該WebAPI定義情報をWebAPI定義情報のリストに追加する(S405)。 When one or more applicable child nodes are found, the WebAPI definition information generation unit 12 generates WebAPI definition information by combining the HTTP method and target path of each applicable child node. The WebAPI definition information is added to the list of WebAPI definition information (S405).
 対象パスリストの全ての要素についてループ処理L6が実行されると、WebAPI定義情報生成部12は、対象パスリストについて生成されたWebAPI定義情報のリストを出力する(S406)。 When the loop processing L6 is executed for all the elements of the target path list, the WebAPI definition information generation unit 12 outputs the list of WebAPI definition information generated for the target path list (S406).
 全てのパスリストについてループ処理L5が実行されると、図13の処理は終了する。 When loop processing L5 is executed for all path lists, the processing in FIG. 13 ends.
 上述したように、本実施の形態によれば、Webアプリケーションのドキュメントに依存することなくWebAPIの定義情報の自動生成を可能にすることができる。すなわち、ソースコード中から探索されたWebAPI定義情報の要素に基づいてWebAPI定義情報が自動生成されるため、Webアプリケーションの実装と自動生成されるWebAPI定義情報との乖離の問題を解決することができる。また、インデントを利用した構造解析の結果から各要素間の関係を推定することで、特定のプログラミング言語の文法に依存せず、幅広いWebアプリケーションからWebAPI定義情報を自動生成することができる。 As described above, according to the present embodiment, it is possible to automatically generate WebAPI definition information without depending on Web application documents. That is, since the WebAPI definition information is automatically generated based on the elements of the WebAPI definition information searched from the source code, it is possible to solve the problem of the discrepancy between the implementation of the Web application and the automatically generated WebAPI definition information. . In addition, by estimating the relationship between elements from the result of structural analysis using indentation, it is possible to automatically generate WebAPI definition information from a wide range of Web applications without depending on the grammar of a specific programming language.
 こうした得たWebAPI定義情報を用いて、例えば、開発者は、手動又は自動でテストデータを生成する技術などを活用して漏れなくテストを作ることができる。 Using the obtained WebAPI definition information, for example, developers can create tests without omission by utilizing techniques such as manual or automatic test data generation.
 なお、本実施の形態において、ソースコード構造解析部11は、解析部の一例である。WebAPI定義情報生成部12は、生成部の一例である。 In addition, in the present embodiment, the source code structure analysis unit 11 is an example of an analysis unit. The WebAPI definition information generator 12 is an example of a generator.
 以上、本発明の実施の形態について詳述したが、本発明は斯かる特定の実施形態に限定されるものではなく、請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。 Although the embodiments of the present invention have been described in detail above, the present invention is not limited to such specific embodiments, and various modifications can be made within the scope of the gist of the present invention described in the claims.・Changes are possible.
10     WebAPI定義情報生成装置
11     ソースコード構造解析部
12     WebAPI定義情報生成部
20     WebAPI定義情報要素探索装置
100    ドライブ装置
101    記録媒体
102    補助記憶装置
103    メモリ装置
104    CPU
105    インタフェース装置
106    表示装置
107    入力装置
B      バス
10 WebAPI definition information generation device 11 Source code structure analysis unit 12 WebAPI definition information generation unit 20 WebAPI definition information element search device 100 Drive device 101 Recording medium 102 Auxiliary storage device 103 Memory device 104 CPU
105 interface device 106 display device 107 input device B bus

Claims (7)

  1.  Webアプリケーションのソースコードにおける各行のインデント幅に基づいて、前記ソースコードにおける各行の親子関係と隣接関係とを保持した情報を生成する解析部と、
     前記ソースコードに含まれているWebAPIの構成要素を、前記親子関係と前記隣接関係とに基づいて組み合わせることで、当該WebAPIの定義情報を生成する生成部と、
    を有することを特徴とするWebAPI定義情報生成装置。
    an analysis unit that generates information holding the parent-child relationship and the adjacency relationship of each line in the source code based on the indentation width of each line in the source code of the Web application;
    a generation unit that generates definition information of the WebAPI by combining the components of the WebAPI included in the source code based on the parent-child relationship and the adjacency relationship;
    A WebAPI definition information generation device characterized by comprising:
  2.  前記解析部は、インデント幅が相対的に大きい行を子とし、インデント幅が相対的に小さい行を親とする前記親子関係を保持した情報を生成する、
    ことを特徴とする請求項1記載のWebAPI定義情報生成装置。
    The analysis unit generates information that holds the parent-child relationship in which a line with a relatively large indentation width is a child and a line with a relatively small indentation width is a parent,
    The Web API definition information generation device according to claim 1, characterized by:
  3.  前記生成部は、前記WebAPIの構成要素を含む行に関する前記親子関係と前記隣接関係とに基づいて、当該WebAPIの構成要素を組み合わせることで、当該WebAPIの定義情報を生成する、
    ことを特徴とする請求項1又は2記載のWebAPI定義情報生成装置。
    The generation unit generates definition information of the WebAPI by combining the components of the WebAPI based on the parent-child relationship and the adjacency relationship regarding a row containing the components of the WebAPI.
    3. The Web API definition information generation device according to claim 1, wherein:
  4.  Webアプリケーションのソースコードにおける各行のインデント幅に基づいて、前記ソースコードにおける各行の親子関係と隣接関係とを保持した情報を生成する解析手順と、
     前記ソースコードに含まれているWebAPIの構成要素を、前記親子関係と前記隣接関係とに基づいて組み合わせることで、当該WebAPIの定義情報を生成する生成手順と、
    をコンピュータが実行することを特徴とするWebAPI定義情報生成方法。
    an analysis procedure for generating information holding a parent-child relationship and an adjacency relationship of each line in the source code based on the indentation width of each line in the source code of the web application;
    a generation procedure for generating definition information of the WebAPI by combining WebAPI components included in the source code based on the parent-child relationship and the adjacency relationship;
    A web API definition information generating method, characterized in that a computer executes:
  5.  前記解析手順は、インデント幅が相対的に大きい行を子とし、インデント幅が相対的に小さい行を親とする前記親子関係を保持した情報を生成する、
    ことを特徴とする請求項4記載のWebAPI定義情報生成方法。
    The analysis procedure generates information that holds the parent-child relationship in which a line with a relatively large indent width is a child and a line with a relatively small indent width is a parent.
    5. The WebAPI definition information generation method according to claim 4, wherein:
  6.  前記生成手順は、前記WebAPIの構成要素を含む行に関する前記親子関係と前記隣接関係とに基づいて、当該WebAPIの構成要素を組み合わせることで、当該WebAPIの定義情報を生成する、
    ことを特徴とする請求項4又は5記載のWebAPI定義情報生成方法。
    The generation procedure generates definition information of the WebAPI by combining the components of the WebAPI based on the parent-child relationship and the adjacency relationship regarding the row containing the component of the WebAPI.
    6. The WebAPI definition information generating method according to claim 4 or 5, characterized in that:
  7.  請求項4乃至6いずれか一項記載のWebAPI定義情報生成方法をコンピュータに実行させることを特徴とするプログラム。 A program characterized by causing a computer to execute the WebAPI definition information generating method according to any one of claims 4 to 6.
PCT/JP2021/017249 2021-04-30 2021-04-30 Web api definition information generation device, web api definition information generation method, and program WO2022230191A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2021/017249 WO2022230191A1 (en) 2021-04-30 2021-04-30 Web api definition information generation device, web api definition information generation method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2021/017249 WO2022230191A1 (en) 2021-04-30 2021-04-30 Web api definition information generation device, web api definition information generation method, and program

Publications (1)

Publication Number Publication Date
WO2022230191A1 true WO2022230191A1 (en) 2022-11-03

Family

ID=83848250

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2021/017249 WO2022230191A1 (en) 2021-04-30 2021-04-30 Web api definition information generation device, web api definition information generation method, and program

Country Status (1)

Country Link
WO (1) WO2022230191A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011086118A (en) * 2009-10-15 2011-04-28 Yokogawa Electric Corp Program input device
JP2018055625A (en) * 2016-09-30 2018-04-05 富士通株式会社 Information processing device, specification creation method, and specification creation program
JP2019125062A (en) * 2018-01-12 2019-07-25 カシオ計算機株式会社 Programming support device, programming support method and program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011086118A (en) * 2009-10-15 2011-04-28 Yokogawa Electric Corp Program input device
JP2018055625A (en) * 2016-09-30 2018-04-05 富士通株式会社 Information processing device, specification creation method, and specification creation program
JP2019125062A (en) * 2018-01-12 2019-07-25 カシオ計算機株式会社 Programming support device, programming support method and program

Similar Documents

Publication Publication Date Title
JP3879350B2 (en) Structured document processing system and structured document processing method
US9342301B2 (en) Converting and input script to a natural language description
US20090106298A1 (en) Information processing method, information processing device, and information processing program
US20100269096A1 (en) Creation, generation, distribution and application of self-contained modifications to source code
JP2005025763A (en) Division program, division device and division method for structured document
US20090007267A1 (en) Method and system for tracking authorship of content in data
JP5005510B2 (en) Software design support method, design support apparatus, and design support program
JPH1049530A (en) Data processing method
JPH0830620A (en) Structure retrieving device
JP2018088242A (en) Data processing apparatus, method, and program
JP2009237762A (en) Program analyzer, program analytical method, and analytical program
JP5347965B2 (en) XML data processing system, data processing method used in the system, and XML data processing control program
US20110087698A1 (en) Search expression creating system, search expression creating method, search expression creating program, and recording medium
JPH10105551A (en) Method for connecting 1st and 2nd clauses as one part of unification of 1st graph while using processor
WO2022230191A1 (en) Web api definition information generation device, web api definition information generation method, and program
JP5042268B2 (en) Proper word acquisition device, machine learning device and method
WO2009113289A1 (en) New case generation device, new case generation method, and new case generation program
Maraist String shuffling over a gap between parsing and plan recognition
JP4646328B2 (en) Related information extraction apparatus and method
CN114296726A (en) Code generation method and device, computer equipment and storage medium
JP4868733B2 (en) Structured document processing apparatus, structured document processing method, and program
JP4207992B2 (en) Structured document processing system and structured document processing method
JP5160120B2 (en) Information search apparatus, information search method, and information search program
JP2005234800A (en) Example machine translation device and example translation computer program, example retrieval device and example retrieval computer program
JP2004178011A (en) Document conversion device and documents conversion method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21939348

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21939348

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: JP