CN109426493A - Handle the method, apparatus and equipment of the description information of application programming interface - Google Patents
Handle the method, apparatus and equipment of the description information of application programming interface Download PDFInfo
- Publication number
- CN109426493A CN109426493A CN201710720113.2A CN201710720113A CN109426493A CN 109426493 A CN109426493 A CN 109426493A CN 201710720113 A CN201710720113 A CN 201710720113A CN 109426493 A CN109426493 A CN 109426493A
- Authority
- CN
- China
- Prior art keywords
- api
- description information
- rest
- rest service
- service
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present invention relates to a kind of method and apparatus of description information for handling API, this method comprises: judging whether a REST service has used message transformer;If the REST service has used message transformer, determination can be carried out at least one API of output parameter type modification by the message transformer from each API of the REST service;And, for each of at least one API described in determining API, the description information of the API is modified, so that the output parameter that its type for including in the description information of the API can be modified by the message transformer has the type after message transformer conversion.Using this method and device, it is capable of providing and the description information of each API for the REST service being actually consistent.
Description
Technical field
The present invention relates to processing application programming interface (API:Application Programming Interface)
Description information method, apparatus and equipment.
Background technique
Declarative state transmitting (REST:Representational State Transfer) is the calculating on network
A kind of mode of interoperability is provided between machine system, is widely used in design micro services (microservice).One REST clothes
Business can provide user's several relevant resources that can be called.
In order to use resource provided by each REST service, user it should be understood that each REST service each
The description information of API (otherwise referred to as method, controller etc.), wherein may include each input of the title of the API, the API
The title and type of parameter, the title of each output parameter of the API and type, the access path of the API are (for example, unified money
Source finger URL (URL:Uniform Resource Locator)) etc..It has already appeared at present some for providing REST service
The description information of the description information of each API provides scheme, allow users to understand its want using REST service.
Under normal conditions, the API of REST service called process is as follows.When client passes through one of the REST service
The access path of API is come when calling the API, which executes the function of setting.Then, which it is defeated implementing result to be placed on its
Parameter out.Finally, the output parameter for including implementing result is supplied to client by the API.The above calling process is REST service
The conventional calling process of message transformer is not used.If REST service has used message transformer, in REST service
Before output parameter comprising implementing result is supplied to client by API, which first will be in these output parameters
Certain or certain form of output parameter are revised as other types.To the case where REST service has used message transformer
Under, by the type of the output parameter of zero or one or multiple API of REST service before message transformer with passing through
The type of the output parameter is different after message transformer.
The output that the description information of each API of REST service provided by current description information offer scheme is recorded
The type of parameter is usually the type before through message transformer, rather than is actually provided after through message transformer
To the type of client.But in order to help the proper use of REST service of user, it should provide a user and actually be consistent
The description information of each API of REST service makes the type of the output parameter of the API of its record and by after message transformer
The type for being actually provided to client is consistent.
To, current description information technical solution be not always able to provide it is each with the REST service that is actually consistent
The description information of API.
Summary of the invention
In view of the problem above of the prior art, the embodiment of the present invention provides the method for the description information of processing API, dress
It sets and equipment, is capable of providing with the description information of each API for the REST service being actually consistent with for users to use.
The method of the description information of a kind of processing API of embodiment according to the invention, comprising: judge a statement character
Whether state transfer REST service has used message transformer;If the REST service has used message transformer, from described
Determination can be carried out at least one API of output parameter type modification by the message transformer in each API of REST service;With
And for each of at least one API described in determining API, the description information of the API is modified, so that the API's retouches
Stating the output parameter that its type for including in information can be modified by the message transformer has by the message transformer turn
Type after changing.Here, when REST service has used message transformer, determine that its in each API of the REST service can quilt
The message transformer carries out at least one API of output parameter type modification, also, modify the REST service this at least one
The description information of API, so that its type for including in the description information of at least one API can be modified by the message transformer
Output parameter there is the type after message transformer conversion, thus, it is possible to provide and the REST service that is actually consistent
Each API description information with for users to use.
Wherein, the description information for modifying the API, comprising: from pre-stored corresponding with each message transformer
Modification strategy in, it is tactful to retrieve corresponding with the message transformer that the REST service uses modification, wherein the modification
The type and modified type for the output parameter that strategy instruction can be modified;And it based on the modification strategy retrieved, repairs
Change the description information of the API.Here, description information is modified using different modification strategies for different message transformers,
Therefore, when there is new message transformer to occur, only it need to simply develop that the message transformer new with this is corresponding to modify strategy
, to be conducive to Function Extension.
Wherein, before judging whether the REST service has used message transformer, the method also includes: identification institute
State REST service at runtime belonging to REST frame;And a specific API from the REST frame identified, read institute
State the description information of each API of REST service, wherein the specific API is used to provide the described each API's of REST service
Description information.Here, by from REST service at runtime belonging to REST frame read each API of the REST service and retouch
Information is stated, the description information of each API of REST service is obtained with can be convenient.
Wherein, the description information of each API for reading the REST service include: using be suitable for from
The REST frame of the identification reads the reading processing routine of description information, from the specific API of the REST frame of the identification,
Read the description information of each API of the REST service.Here, different for different REST Development of Framework
Processing routine is read to read API description information, therefore, when there is new REST frame to occur, only need to simply be developed new with this
REST frame read processing routine accordingly, to be conducive to Function Extension.
Wherein, the identification REST service at runtime belonging to REST frame be based on the REST service according to
What Lai Ku was carried out.Here, the REST frame belonging to being identified using the dependence library of REST service when REST service is run, Ke Yifang
Just the REST frame belonging to when quickly identification REST service is run.
It is wherein, described that judge whether a REST service has used message transformer be the dependence based on the REST service
What library carried out.Here, judge whether REST service has used message transformer using the dependence library of REST service, can be convenient
Quickly determine whether REST service has used message transformer.
The device of the description information of a kind of processing API of embodiment according to the invention a, comprising: judgment module is used
In judging whether a declarative state transfer REST service has used message transformer;One determining module, if for described
REST service has used message transformer, then from each API of the REST service determination can by the message transformer into
At least one API of row output parameter type modification;And a modified module, for for described in determining at least one
Each of API API, modifies the description information of the API, so that its type for including in the description information of the API can quilt
The output parameter of the message transformer modification has the type after message transformer conversion.Here, when REST takes
It make sures when having used message transformer, determines that its in each API of the REST service can carry out output parameter by the message transformer
At least one API of type modification, also, the description information of at least one API of the REST service is modified, so that this is extremely
Its type for including in the description information of a few API can be had by the output parameter that the message transformer is modified by the message
Converter conversion after type, thus, it is possible to provide with the description information of each API for the REST service being actually consistent for
Family uses.
Wherein, the modified module includes: a retrieval module, for from pre-stored with each message transformer phase
In corresponding modification strategy, modification strategy corresponding with the message transformer that the REST service uses is retrieved, wherein described
The type and modified type for the output parameter that modification strategy instruction can be modified;And a change module, it is used for base
In the modification strategy retrieved, the description information of at least one API is modified.Here, different message transformers is made
Modify description information with different modification strategies, therefore, when there is new message transformer to occur, only need to simply develop with
The new message transformer modifies strategy accordingly, to be conducive to Function Extension.
Wherein, described device further include: an identification module, for judging whether the REST service has used message
Before converter, identify the REST service at runtime belonging to REST frame;And a read module, it is used for from institute
One specific API of the REST frame of identification, reads the description information of each API of the REST service, wherein described specific
API is used to provide the described the description information of each API of REST service.Here, by from REST service at runtime belonging to
REST frame reads the description information of each API of the REST service, obtains retouching for each API of REST service with can be convenient
State information.
Wherein, the read module is further used for: being believed using being suitable for reading description from the REST frame of the identification
The reading processing routine of breath reads the described each of the REST service from the specific API of the REST frame of the identification
The description information of API.Here, the reading processing routine different for different REST Development of Framework is believed to read API description
Therefore breath when there is new REST frame to occur, only need to simply develop that the REST frame new with this is corresponding to read processing routine
, to be conducive to Function Extension.
Wherein, the identification REST service at runtime belonging to REST frame be based on the REST service according to
What Lai Ku was carried out.Here, the REST frame belonging to being identified using the dependence library of REST service when REST service is run, Ke Yifang
Just the REST frame belonging to when quickly identification REST service is run.
It is wherein, described that judge whether a REST service has used message transformer be the dependence based on the REST service
What library carried out.Here, judge whether REST service has used message transformer using the dependence library of REST service, can be convenient
Quickly determine whether REST service has used message transformer.
Wherein, described device further include: a card module, for starting the processing unit when called upon.Here,
Start described device with can be convenient using card module.
A kind of equipment of the description information of processing API of embodiment according to the invention, comprising: processor;And storage
Device, for storing executable instruction, when the executable instruction is performed, so that the processor executes method above-mentioned.
A kind of machine readable media of embodiment according to the invention is stored thereon with executable instruction, described executable
Instruction makes machine execute method above-mentioned upon being performed.
Detailed description of the invention
Other feature of the invention, feature, advantage and benefit will be become more by the detailed description below in conjunction with attached drawing
Obviously.
Fig. 1 shows the framework signal of the generator of the description information of the processing API of one embodiment according to the invention
Figure.
Fig. 2 shows the overview flow charts of the method for the description information of the processing API of one embodiment according to the invention.
Fig. 3 shows the flow chart of the method for the description information of the processing API of one embodiment according to the invention.
Fig. 4 shows the schematic diagram of the device of the description information of the processing API of one embodiment according to the invention.
Fig. 5 shows the schematic diagram of the equipment of the description information of the processing API of one embodiment according to the invention.
10: generator 20: plug-in unit
30:API analyzer 40: converter
42: built-in policy library 45: custom strategies library
50:API description information collection 60:API describes file
70: user 200: method
202: identification REST frame 204: determining whether there is reading processing routine
206: choosing and read processing routine 208: determining whether there is reading processing routine
210: choosing and read processing routine 212: output message
214: reading description information 216: being packaged description information
218: judging whether using message transformer 220: determining whether there is modification strategy
222: output error messages 224: determining API
226: modification description information 228: generating API and describe file
300: method 302: judging whether using message transformer
304: determining API 306: modification description information
400: device 402: judgment module
404: determining module 406: modified module
500: equipment 502: processor
504: memory
Specific embodiment
The scheme of the embodiment of the present invention provides a kind of scheme of description information for handling API, when a REST service
When having used message transformer, its type meeting for including in the description information of each API of the acquired REST service is modified
The output parameter modified by the message transformer has the type after message transformer conversion, thus, reality of the invention
The scheme for applying example is capable of providing with the description information of each API for the REST service being actually consistent with for users to use.
Next, with reference to each embodiment of attached drawing detailed description of the present invention.
Referring now to Fig. 1, it illustrates the generators of the description information of the processing API of one embodiment according to the invention
Configuration diagram.In the present embodiment, generator 10 shown in FIG. 1 can utilize software realization and can be compiled into library file
Form.
As shown in Figure 1, generator 10 may include three modules: plug-in unit 20, API analyzer 30 and converter 40.
Plug-in unit 20 starts generator 10 so that it brings into operation when called upon.
In general, each REST service operates in server S.If user 70 will obtain one using generator 10
The API description information of each API of REST service OB, then user 70 is in the REST service OB being stored in server S first
Configuration file in addition one for by the library file of generator 10 including into the class.path of REST service OB to become
The order in a dependence library of REST service OB.(REST service OB is loaded into it in server S starting REST service OB
Bring into operation in depositing) when, server S execute in the configuration file of REST service OB for by the library file of generator 10 including
To the order in the class.path of REST service OB, so that the library file of generator 10 is included the class.path of REST service OB
In with become REST service OB a dependence library.Then, server S checks each dependence in the class.path of REST service OB
Library is to search whether to have the object for needing to be activated while REST service OB is activated, and here, generator 10 is to work as
The object for needing to be activated while REST service OB is activated.To which server S calls the plug-in unit 20 of generator 10 to start
Generator 10.Here, the starting of generator 10 is conducive to using plug-in unit 20 with can be convenient.As known to those skilled in the art
, dependence library mentioned herein typically refer to third party exploitation in the form of library file existing for program.
API analyzer 30 be used for after generator 10 is activated, from REST service OB run when belonging to REST frame
A specific API in, read REST service OB each API description information, with obtain REST service OB API description letter
Breath collection 50.REST frame belonging to when REST service OB is run is activated in REST service OB starting.REST service OB
REST frame belonging to when can run after start-up to it registers the description information of its each API.When REST service OB is run
Affiliated REST frame includes the specific API of a description information dedicated for each API for providing REST service OB, from this
Specific API can read the description information of each API of REST service OB.The REST service of different software platforms exploitation, fortune
REST frame belonging to when row is different, for example, an example of the REST frame belonging to when REST service is run is
Spring frame.Also, dedicated for providing each API for the REST service for belonging to it included by different REST frames
The specific API of description information is also different.To, usually when identifying the operation of REST service belonging to REST frame
Later, just can know that it is which API of the REST frame provides the description information of each API of the REST service.Usual feelings
Under condition, when the operation of REST service belonging to REST frame be in the form of a dependence library of the REST service existing for,
Therefore, it is possible to the REST frame belonging to when identifying REST service operation by the dependence library for consulting the REST service.
There is API analyzer 30 built-in reading table BI1 and customization to read table CU1.Table is read in built-in reading table BI1 and customization
Each of CU1 is used to record the description information that instruction is suitable for reading each API of REST service from different REST frames
Each reading processing routine information.Wherein, each reading processing routine being previously mentioned in built-in reading table BI1 is all and generator
10 are together developed.The each reading processing routine being previously mentioned in customization reading table CU1 is developed in generator 10
It is developed by user as desired for some other REST frame after coming.For example, built-in reading table BI1 and customization are read
Take each reading processing routine being previously mentioned in table CU1 that can be compiled into the form in dependence library of generator 10.Such as but not office
It is limited to, the reading processing routine being previously mentioned in built-in reading table BI1 can be the reading processing suitable for common operation REST frame
Program, and, customizing the reading processing routine mentioned in reading table CU1 can be suitable for some uncommon operation REST frames
Reading processing routine.Here, the reading processing routine different for different REST Development of Framework reads API description information, because
This only need to simply develop that the REST frame new with this is corresponding to read processing routine when there is new REST frame to occur,
To be conducive to Function Extension.
Converter 40 is used for when REST service OB has used message transformer, for each API of REST service OB
Middle one or more API that the modification of output parameter type can be carried out by the message transformer, modifying should in API description information collection 50
The description information of one or more API, so that its type for including in the description information of one or more API can be disappeared by this
The output parameter for ceasing converter modification has the type after message transformer conversion, and, as above modified it
Afterwards, file is described to form API using the description information of each API of REST service OB included by API description information collection 50
60 for the use of user 70.
Converter 40 has built-in policy library 42 and custom strategies library 45.Built-in policy library 42 and custom strategies library 45 it is every
One for storing modification strategy corresponding with each message transformer, wherein modification strategy instruction can be converted by message
The type and modified type of the output parameter of the API of device modification.Generator 10 is based on built-in policy library 42 and customization plan
The modification strategy that library 45 is stored is omited to modify the description information in API description information collection 50.Built-in policy library 42 is for storing
With generator 10 by the modification strategy of the synchronous generation of exploitation, custom strategies library 45 is developed it for being stored in generator 10
The modification strategy just generated according to actual needs afterwards.Here, such as, but not limited to, built-in policy library 42 can store with it is each
The corresponding modification strategy of common message transformer, and, custom strategies library 45 can store and each uncommon message
The corresponding modification strategy of converter.Here, description is modified using different modification strategies for different message transformers
Therefore information when there is new message transformer to occur, only need to simply develop that new message transformer is corresponding repairs with this
Change strategy, to be conducive to Function Extension.
Referring now to Fig. 2, it illustrates the methods of the description information of the processing API of one embodiment according to the invention
Overview flow chart.Method 200 shown in Fig. 2 is described in detail below with reference to generator 10 shown in FIG. 1.
As shown in Fig. 2, identifying REST frame, it may be assumed that when generator while REST service OB is activated in box 202
After 10 are also started up, the API analyzer 30 of generator 10 can check dependence included in the class.path of REST service OB
Library (i.e. the dependence library that REST service OB is used) with identify REST service OB at runtime belonging to REST frame.
In box 204, it is determined whether there are reading processing routines, it may be assumed that the API analyzer 30 of generator 10 checks built-in reading
What table BI1 was recorded is suitable for reading the information of each reading processing routine of description information from different REST frames, with determination
With the presence or absence of the reading processing routine for being suitable for reading description information from the operation REST frame identified.
In box 206, chooses and read processing routine, it may be assumed that if the inspection result of box 204 is affirmative, generator 10
API analyzer 30, which is chosen, to be suitable for reading the reading processing routine of description information for REST from the operation REST frame identified
OB is serviced, then process proceeds to box 214.
In box 208, it is determined whether there are reading processing routines, it may be assumed that if the inspection result of box 204 is negative, give birth to
The 10 API analyzer 30 of growing up to be a useful person checks that customization reading table CU1 recorded is suitable for reading description letter from different REST frame
The information of each reading processing routine of breath is suitable for reading description letter from the operation REST frame identified to determine whether there is
The reading processing routine of breath.
In box 210, chooses and read processing routine, it may be assumed that if the inspection result of box 208 is affirmative, generator 10
API analyzer 30 is chosen the reading processing routine for being suitable for reading description information from the operation REST frame identified and is taken for REST
Be engaged in OB, and then process proceeds to box 214.
In box 212, message is exported, it may be assumed that if the inspection result of box 208 is negative, the API analyzer of generator 10
30 outputs are used to indicate the message that cannot read API description information, and then process terminates.
In box 214, description information is read, it may be assumed that the API analyzer 30 of generator 10 is chosen using box 206 or 210
Processing routine is read, the description information of each API of REST service OB is read from the operation REST frame identified.
In box 216, it is packaged description information, it may be assumed that read description information is packaged by the API analyzer 30 of generator 10
At API description information collection 50.
In box 218, judge whether using message transformer, it may be assumed that the converter 40 of generator 10 checks REST service OB
Class.path in dependence library, to judge whether used message transformer in REST service OB.
If the judging result of box 218 is negative, process terminates.
In box 220, it is determined whether there is modification strategy, it may be assumed that if the judging result of box 218 is affirmative, that is, exist
REST service OB has used message transformer CON, then the converter 40 of generator 10 checks built-in Policy Table 42 and customization plan
Sketch form 45, with the message transformer CON determined whether there is with REST service OB is used corresponding modification strategy.
In box 222, error messages are exported, it may be assumed that if the inspection result of box 220 is negative, generator 10 turns
40 output error message of parallel operation, then process terminates.
In box 224, API is determined, it may be assumed that if the judging result of box 220 is affirmative, the converter 40 of generator 10
Joined based on meeting indicated by modification strategy corresponding with message transformer CON by the output of the message transformer CON API modified
Several types checks the description information of each API of REST service OB included in API description information collection 50, with determination
Its in each API of REST service OB has output parameter to carry out at least the one of the modification of output parameter type by message transformer CON
A API.
In box 226, description information is modified, it may be assumed that the converter 40 of generator 10 is based on corresponding with message transformer CON
Modification strategy indicated by meeting by the type and modified type of the output parameter of the message transformer CON API modified,
Description information included in API description information collection 50 is modified, so that 222 institute of box for including in API description information collection 50
The output parameter that its type for including in the description information of at least one determining API can be modified by message transformer CON has
Type after message transformer CON conversion.
In box 228, generates API and describe file, it may be assumed that the API that the converter 40 of generator 10 generates REST service OB is retouched
State file comprising API description information included in modified API description information collection 50.
Other modifications
Although it will be appreciated by those skilled in the art that in the above embodiments, generator 10 include plug-in unit 20 with
By calling plug-in unit 20 easily to start generator 10 while REST service is activated, however, the present invention is not limited thereto.
In some other embodiment of the invention, generator 10 can not also include plug-in unit 20, in this case, such as can pass through
By user be manually operated and start generator 10 (such as on computers user double-click generator 10 icon etc.) mode Lai
Start generator 10.
Although it will be appreciated by those skilled in the art that in the above embodiments, being read using built-in reading table BI1 and customization
Two tables of table CU1 are taken to record the description information that instruction is suitable for reading each API of REST service from different REST frames
Each reading processing routine information, however, the present invention is not limited thereto.It, can in some other embodiment of the invention
A table is synthesized so that built-in reading table BI1 and customization are read table CU1.
Although it will be appreciated by those skilled in the art that in the above embodiments, being described for reading API from REST frame
The function of information is realized by the reading processing routine isolated with generator 10, however, the present invention is not limited thereto.In this hair
In some other bright embodiment, the function for reading API description information from REST frame is also possible to by generator 10 certainly
Body is realized, in such a case it is not necessary to which built-in reading table BI1 and customization is used to read table CU1.
Although it will be appreciated by those skilled in the art that in the above embodiments, using built-in policy library 42 and customization plan
Slightly library 45 is tactful to store modification corresponding with each message transformer, however, the present invention is not limited thereto.In the present invention
Some other embodiment in, built-in policy library 42 and custom strategies library 45 can be synthesized a library.
Although it will be appreciated by those skilled in the art that in the above embodiments, in the class.path based on REST service OB
Included dependence library come conveniently and efficiently identify REST service OB operation when belonging to REST frame, however, the present invention is not
It is confined to this.In some other embodiment of the invention, it can also identify that REST service OB is run by another way
When belonging to REST frame.
Although it will be appreciated by those skilled in the art that in the above embodiments, in the class.path based on REST service OB
Dependence library conveniently and efficiently judge whether used message transformer in REST service OB, however, the present invention does not limit to
In this.In some other embodiment of the invention, it can also judge by another way whether make at REST service OB
With message transformer.
Referring now to Fig. 3, it illustrates the methods of the description information of the processing API of one embodiment according to the invention
Flow chart.
As shown in figure 3, method 300 may include, in box 302, judge whether to have used message transformer, it may be assumed that judgement
Whether one REST service has used message transformer.
Method 300 can also include, in box 304, determining API, it may be assumed that if the REST service has used message conversion
Device, then from each API of the REST service determination can by the message transformer carry out the modification of output parameter type to
A few API.
Method 300 can also include, and in box 306, modify description information, it may be assumed that at least one API described in determining
Each of API, the description information of the API is modified, so that its type for including in the description information of the API can be described
The output parameter of message transformer modification has the type after message transformer conversion.
Box 302-306 can be executed for example by the converter 40 of generator 10.Here, disappear when REST service has used
When ceasing converter, determine that its in each API of the REST service can carry out the modification of output parameter type by the message transformer
At least one API, also, the description information of at least one API of the REST service is modified, so that at least one API
Description information in include its type can be had by output parameter that the message transformer is modified and turn by the message transformer
Type after changing, thus, it is possible to provide with the description information of each API for the REST service being actually consistent with for users to use.
In one aspect, box 306 may include: from pre-stored modification plan corresponding with each message transformer
In slightly, modification strategy corresponding with the message transformer that the REST service uses is retrieved, wherein the modification strategy instruction
The type and modified type for the output parameter that can be modified;And based on the modification strategy retrieved, modification is described extremely
The description information of each of few API API.Here, different modification strategies is used for different message transformers
Description information is modified, therefore, when there is new message transformer to occur, only need to simply develop the message transformer new with this
Corresponding modification strategy, to be conducive to Function Extension.
On the other hand, before judging whether the REST service has used message transformer, method 300 can be with
Include: the identification REST service at runtime belonging to REST frame;And it is specific from one of the REST frame identified
API reads the description information of each API of the REST service, wherein the specific API is used to provide the described REST service
Each API description information.The identification REST frame and the description information that reads can such as origin generators 10
API analyzer 30 executes.Here, by from REST service at runtime belonging to REST frame read each of the REST service
The description information of a API obtains the description information of each API of REST service in which can be convenient.
In yet another aspect, the description information of each API for reading the REST service may include:
Using the reading processing routine for being suitable for reading description information from the REST frame of the identification, from the REST frame of the identification
The specific API reads the description information of each API of the REST service.Here, for different REST frames
Frame develops different reading processing routines to read API description information, therefore, when there is new REST frame to occur, only needs simple
The exploitation REST frame new with this in ground is corresponding to read processing routine, to be conducive to Function Extension.
In another aspect, the identification REST service at runtime belonging to REST frame can be based on described
REST service relies on what library carried out.Here, belonging to being identified using the dependence library of REST service when REST service is run
REST frame can be convenient the REST frame belonging to quickly identifying when REST service is run.
It is described to judge whether a REST service has used message transformer to can be based on described in another aspect
REST service relies on what library carried out.Here, judge whether REST service has used message using the dependence library of REST service
Converter can be convenient and quickly determine whether REST service has used message transformer.
Referring now to Fig. 4, it illustrates the devices of the description information of the processing API of one embodiment according to the invention
Schematic diagram.Device 400 shown in Fig. 4 can use the side of software, hardware (such as integrated circuit or DSP etc.) or software and hardware combining
Formula is realized.
As shown in figure 4, device 400 may include 402, determining modules 404 of a judgment module and a modification mould
Block 406.Judgment module 402 is for judging whether a declarative state transfer REST service has used message transformer.It determines
If module 404 has used message transformer for the REST service, determining from each API of the REST service can quilt
The message transformer carries out at least one API of output parameter type modification.Modified module 406 is used for for described in determining
Each of at least one API API modifies the description information of the API, so that its for including in the description information of the API
The output parameter that type can be modified by the message transformer has the type after message transformer conversion.Judge mould
Block 402, determining module 404 and modified module 406 can be realized for example by the converter 40 of generator 10.Here, when one
When REST service has used message transformer, it is defeated to determine that its in each API of the REST service can be carried out by the message transformer
At least one API of parameter type modification out, also, the description information of at least one API of the REST service is modified, so that
Process can be had by the output parameter that the message transformer is modified by obtaining its type for including in the description information of at least one API
Type after message transformer conversion, thus, it is possible to provide and the description information of each API for the REST service being actually consistent
With for users to use.
In one aspect, modified module 406 may include: a retrieval module, for disappearing from pre-stored with each
It ceases in the corresponding modification strategy of converter, retrieves modification plan corresponding with the message transformer that the REST service uses
Slightly, wherein the type and modified type for the output parameter that the modification strategy instruction can be modified;And one more
Change module, for modifying the description information of at least one API based on the modification strategy retrieved.Here, for different
Message transformer modifies description information using different modification strategies, therefore, when there is new message transformer to occur, only needs
It is tactful simply to develop the corresponding modification of new with this message transformer, to be conducive to Function Extension.
On the other hand, device 400 can also include: an identification module, for judging that the REST service is
It is no used message transformer before, identify the REST service at runtime belonging to REST frame;An and reading mould
Block reads the description information of each API of the REST service for a specific API from the REST frame identified,
In, the specific API is used to provide the described the description information of each API of REST service.Here, by being transported from REST service
REST frame belonging to when row reads the description information of each API of the REST service, obtains REST service with can be convenient
The description information of each API.
In yet another aspect, the read module is further used for: using suitable for reading from the REST frame of the identification
The reading processing routine for taking description information reads the institute of the REST service from the specific API of the REST frame of the identification
State the description information of each API.Here, the reading processing routine different for different REST Development of Framework reads API
Therefore description information when there is new REST frame to occur, only need to be developed simply at the corresponding reading of the REST frame new with this
Program is managed, to be conducive to Function Extension.
In another aspect, the identification REST service at runtime belonging to REST frame be based on the REST
Service relies on what library carried out.Here, the REST belonging to identifying REST service at runtime using the dependence library of REST service
Frame can be convenient the REST frame belonging to quickly identifying REST service at runtime.
In another another aspect, described to judge whether a REST service has used message transformer be based on the REST
Service relies on what library carried out.Here, judge whether REST service has used message conversion using the dependence library of REST service
Device can be convenient and quickly determine whether REST service has used message transformer.
In another aspect, device 400 further include: a card module, for starting described device when called upon.
Here, it can be convenient ground starter 400 using card module.
Referring now to Fig. 5, it illustrates showing for the equipment of the description information of the processing API according to one embodiment of the invention
It is intended to.As shown in figure 5, equipment 500 may include at least one processor 502 and at least one processor 504.At least one is deposited
Reservoir 504 is for storing executable instruction, when the executable instruction is performed so that at least one 502 execution method of processor
Operation included by 200 or 300.
The embodiment of the present invention also provides a kind of machine readable media, is stored thereon with executable instruction, when this is executable
Instruction is performed, so that operation included by machine executed method 200 or 300.
Machine readable instructions are stored on the machine readable media, which makes when being executed by processor
Processor executes any method above-mentioned.Specifically, system or device equipped with machine readable media can be provided, at this
It stores the software program code for realizing the function of any embodiment in above-described embodiment on machine readable media, and makes the system
Or the computer or processor of device read and execute the machine readable instructions being stored in the machine readable media.
In this case, it can be achieved any one in above-described embodiment from the program code itself that machine readable media is read
The function of embodiment, thus the machine readable media of machine readable code and storage machine readable code constitute it is of the invention
A part.
The embodiment of machine readable media include floppy disk, hard disk, magneto-optic disk, CD (such as CD-ROM, CD-R, CD-RW,
DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), tape, non-volatile memory card and ROM.It selectively, can be by communication network
Network download program code from server computer or on cloud.
It will be appreciated by those skilled in the art that each embodiment disclosed above can be in the situation without departing from invention essence
Under make various changes and modifications.Therefore, protection scope of the present invention should be defined by the appended claims.
It should be noted that step and module not all in above-mentioned each process and each system construction drawing is all necessary
, certain steps or module can be ignored according to the actual needs.Each step execution sequence be not it is fixed, can be according to need
It is adjusted.System structure described in the various embodiments described above can be physical structure, be also possible to logical construction, that is, have
A little modules may be realized by same physical entity, be realized alternatively, some modules may divide by multiple physical entities, alternatively, can be with
It is realized jointly by certain components in multiple autonomous devices.
In the above various embodiments, hardware cell mechanically or can be realized electrically.For example, a hardware list
Member may include permanent dedicated circuit or logic (such as special processor, FPGA or ASIC) to complete corresponding operating.Firmly
Part unit can also include programmable logic or circuit (such as general processor or other programmable processors), can by software into
The interim setting of row is to complete corresponding operating.Concrete implementation mode (mechanical system or dedicated permanent circuit or is faced
When the circuit that is arranged) can be determined based on cost and temporal consideration.
Detailed displaying and explanation carried out to the present invention above by attached drawing and preferred embodiment, however the present invention is not limited to
These embodiments having revealed that, base could be aware that with above-mentioned multiple embodiment those skilled in the art, can combine above-mentioned difference
Code audit means in embodiment obtain the more embodiments of the present invention, these embodiments also protection scope of the present invention it
It is interior.
Claims (13)
1. a kind of method for the description information for handling application programming interface API, comprising:
Judge whether a declarative state transfer REST service has used message transformer;
If the REST service has used message transformer, determination can be disappeared by described from each API of the REST service
Cease at least one API that converter carries out the modification of output parameter type;And
For each of at least one API described in determining API, the description information of the API is modified, so that the API
The output parameter that its type for including in description information can be modified by the message transformer, which has, passes through the message transformer
Type after conversion.
2. the method as described in claim 1 (300), wherein the description information for modifying the API, comprising:
From pre-stored modification strategy corresponding with each message transformer, retrieval disappears with what the REST service used
Cease the corresponding modification strategy of converter, wherein the modification strategy indicates the type for the output parameter that can be modified and repairs
Type after changing;And
Based on the modification strategy retrieved, the description information of the API is modified.
3. it is method according to claim 1 or 2, before judging whether the REST service has used message transformer, also
Include:
REST frame belonging to identifying the REST service at runtime;And
From a specific API of the REST frame identified, the description information of each API of the REST service is read, wherein
The specific API is used to provide the described the description information of each API of REST service.
4. method as claimed in claim 3, wherein the description information of each API for reading the REST service includes:
Using the reading processing routine for being suitable for reading description information from the REST frame of the identification, from the REST frame of the identification
The specific API of frame, reads the description information of each API of the REST service.
5. the method as claimed in claim 3 or 4, wherein the identification REST service at runtime belonging to REST frame
Frame is that the dependence library based on the REST service carries out.
6. method as claimed in any one of claims 1 to 5, described to judge whether a REST service has used message transformer
It is that the dependence library based on the REST service carries out.
7. a kind of device (400) for the description information for handling application programming interface API, comprising:
One judgment module (402), for judging whether a declarative state transfer REST service has used message transformer;
One determining module (404), if having used message transformer for the REST service, from each of the REST service
Determination can be carried out at least one API of output parameter type modification by the message transformer in a API;And
One modified module (406), for modifying the API's for each of at least one API described in determining API
Description information, so that the output parameter that its type for including in the description information of the API can be modified by the message transformer
With the type after message transformer conversion.
8. device (400) as claimed in claim 7, wherein the modified module (406) includes:
One retrieval module is used for from pre-stored modification strategy corresponding with each message transformer, retrieval and institute
State the corresponding modification strategy of message transformer that REST service uses, wherein the modification strategy instruction can be modified defeated
The type of parameter and modified type out;And
One change module, for modifying the description information of at least one API based on the modification strategy retrieved.
9. device (400) as claimed in claim 7 or 8, wherein further include:
One identification module, for identifying the REST before judging whether the REST service has used message transformer
REST frame belonging to service at runtime;And
One read module reads each of the REST service for a specific API from the REST frame identified
The description information of API, wherein the specific API is used to provide the described the description information of each API of REST service.
10. device (400) as claimed in claim 9, wherein the read module is further used for:
Using the reading processing routine for being suitable for reading description information from the REST frame of the identification, from the REST frame of the identification
The specific API of frame reads the description information of each API of the REST service.
11. such as the described in any item devices of claim 7~10 (400), further includes:
One card module, for starting the processing unit when called upon.
12. a kind of equipment (500) for the description information for handling application programming interface API, comprising:
At least one processor (502);And
At least one processor (504), for storing executable instruction, when the executable instruction is performed, so that described
At least one processor (502) perform claim requires any one of method in 1-6.
13. a kind of machine readable media, is stored thereon with executable instruction, the executable instruction makes machine upon being performed
Perform claim requires any one of method in 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710720113.2A CN109426493A (en) | 2017-08-21 | 2017-08-21 | Handle the method, apparatus and equipment of the description information of application programming interface |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710720113.2A CN109426493A (en) | 2017-08-21 | 2017-08-21 | Handle the method, apparatus and equipment of the description information of application programming interface |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109426493A true CN109426493A (en) | 2019-03-05 |
Family
ID=65497908
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710720113.2A Pending CN109426493A (en) | 2017-08-21 | 2017-08-21 | Handle the method, apparatus and equipment of the description information of application programming interface |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109426493A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101387956A (en) * | 2007-09-14 | 2009-03-18 | 国际商业机器公司 | Method and apparatus for expandably implementing non functional logic |
CN103473243A (en) * | 2012-06-08 | 2013-12-25 | 富士通株式会社 | Method and device for generating semantic network service document |
US20160012350A1 (en) * | 2014-07-12 | 2016-01-14 | Microsoft Technology Licensing, Llc | Interoperable machine learning platform |
US20160057207A1 (en) * | 2014-08-20 | 2016-02-25 | Futurewei Technologies, Inc. | AUTOMATING CLIENT DEVELOPMENT FOR NETWORK APIs |
CN106663002A (en) * | 2014-06-25 | 2017-05-10 | 甲骨文国际公司 | REST service source code generation |
-
2017
- 2017-08-21 CN CN201710720113.2A patent/CN109426493A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101387956A (en) * | 2007-09-14 | 2009-03-18 | 国际商业机器公司 | Method and apparatus for expandably implementing non functional logic |
CN103473243A (en) * | 2012-06-08 | 2013-12-25 | 富士通株式会社 | Method and device for generating semantic network service document |
CN106663002A (en) * | 2014-06-25 | 2017-05-10 | 甲骨文国际公司 | REST service source code generation |
US20160012350A1 (en) * | 2014-07-12 | 2016-01-14 | Microsoft Technology Licensing, Llc | Interoperable machine learning platform |
US20160057207A1 (en) * | 2014-08-20 | 2016-02-25 | Futurewei Technologies, Inc. | AUTOMATING CLIENT DEVELOPMENT FOR NETWORK APIs |
Non-Patent Citations (2)
Title |
---|
LI LI、WU CHOU、WEI ZHOU等: "Design Patterns and Extensibility of REST API for Networking", 《IEEE TRANSACTIONS ON NETWORK AND SERVICE MANAGEMENT》 * |
王仲洲、杨晓洪、王剑平等: "基于REST风格的WEB API架构研究", 《微处理机》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9582268B2 (en) | Automatic communications graphing for a source application | |
US20160350081A1 (en) | Automatic container definition | |
CN109783388B (en) | UI (user interface) automatic testing method and device and electronic equipment | |
CN110249307A (en) | System and method for executing primary contract on block chain | |
US10579354B2 (en) | Method and system for rapid deployment and execution of customized functionality across multiple distinct platforms | |
CA2927700C (en) | Generating and providing a self-service demonstration to facilitate performance of a self-service task | |
US20240069877A1 (en) | Method and device for generating application based on android system, and storage medium | |
CN107463406A (en) | Issue the method and electronic equipment of Mobile solution | |
US7949610B2 (en) | Method and system for discovering dependencies in project plans of distributed system | |
US20190384581A1 (en) | Systems and methods for integrating modules into a software application | |
US20170068915A1 (en) | Computer implemented system and method for dynamically optimizing business processes | |
CN109144512A (en) | A kind of method and system generating API | |
JP2019219737A (en) | Interactive server, interactive method and interactive program | |
CN109426493A (en) | Handle the method, apparatus and equipment of the description information of application programming interface | |
JP6097231B2 (en) | Program generating apparatus and method | |
US20020095655A1 (en) | Apparatus and method for generating enterprise java beans based on class diagram | |
US8484624B1 (en) | Test integration tool | |
CN115878475A (en) | Abnormal scene testing method, device and system | |
US11640414B2 (en) | Generating workflow, report, interface, conversion, enhancement, and forms (WRICEF) objects for enterprise software | |
JP5042047B2 (en) | Method, tool and computer readable medium for generating functional shortcuts from pluggable components | |
US10805176B2 (en) | SW framework support method for open IPMI and DCMI development | |
JP2003140893A (en) | Device and method for automatically creating user interface program, program and storage medium | |
JP2016146022A (en) | Model base development support device, model base development support method, and model base development support program | |
JP7284210B2 (en) | Generation of enterprise software workflow, reports, interfaces, transformations, extensions, and forms (WRICEF) objects | |
CN109194734A (en) | Information push method, device, server and readable storage medium storing program for executing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190305 |
|
WD01 | Invention patent application deemed withdrawn after publication |